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 TheComet   Crossbones+   -  Reputation: 2533

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?


"Windows 10 doesn't only include spyware, it is designed as spyware" -- Gaius Publius, The Big Picture RT Interview

"[...] we will access, disclose and preserve personal data, including your content (such as the content of your emails, other private communications or files in private folders), when we have a good faith belief that doing so is necessary" -- Windows 10 Privacy Statement


#2 dave j   Members   -  Reputation: 632

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 Bregma   Crossbones+   -  Reputation: 7817

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.




PARTNERS