# [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 on other sites
dave j    681
Are you starting your script with

#! /bin/sh

Try starting it with

#! /bin/bash

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