6

I need to create 26 files named a to z in single command. I thought touch command would be sufficient with the regex, but it doesn't expand [a-z] instead it creates a single file with name "[a-z]".

$ touch [a-z]

Any way to achieve these?

Note:

$ bash -version
 GNU bash, version 4.3.30(1)-release (i686-pc-linux-gnu)
mtk
  • 27,530
  • 35
  • 94
  • 130

1 Answers1

13

In bash (version 3.0 (2004) and above), ksh (since ksh93r (2006)) and zsh (version 5.0.6 (2014) and above):

touch {a..z}

(note that only zsh supports characters other than ASCII letters and digits, none goes as far as perl's .. operator which inspired those shells operators).

With other zsh version (since 2.2 (1992)):

setopt braceccl
touch {a-z}
cuonglm
  • 153,898