Jump to content

  • Log In with Google      Sign In   
  • Create Account

[Bash] Iterate through alphabet not working?


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1   Members   

2674
Like
0Likes
Like

Posted 15 March 2014 - 05:07 PM

I have the need to generate 26 folders on a linux system, one for each letter of the alphabet. I tried the following:

for x in {a..z}
do
    mkdir $x
done

Interestingly, this created only one folder with the name "{a..z}" instead of the expected 26 folders.

 

I looked on google, but it seems no one else is having this issue, and the code above is what everyone else is doing to generate their 26 folders. What's going on?


"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty


#2   Members   

681
Like
0Likes
Like

Posted 15 March 2014 - 05:30 PM

Are you starting your script with

#! /bin/sh

Try starting it with

#! /bin/bash


#3   Members   

8302
Like
0Likes
Like

Posted 15 March 2014 - 07:17 PM

... and if you're not starting with any hash-bang, it will default to using sh instead of bash, so you still won't get bashisms.


Edited by Bregma, 15 March 2014 - 07:17 PM.

Stephen M. Webb
Professional Free Software Developer




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.