Sign in to follow this  
TheComet

[Bash] Iterate through alphabet not working?

Recommended Posts

TheComet    3896

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?

Share this post


Link to post
Share on other sites
Bregma    9199

... 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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this