Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(zsh brace expansion | seq) for character lists - how?

Bash allows me to write the statement,

$ for i in {h..k} ; do echo $i ; done

but zsh only allows number list expansion such as {8..13}.

What's the best workaround? Something like seq for characters...

like image 634
nidi Avatar asked Mar 07 '10 01:03

nidi


1 Answers

zsh$ setopt BRACE_CCL
zsh$ echo {a-k}
a b c d e f g h i j k
zsh$ echo {1-9}
1 2 3 4 5 6 7 8 9

From ZSH Documentation:

BRACE_CCL

Expand expressions in braces which would not otherwise undergo brace expansion to a lexically ordered list of all the characters. See Brace Expansion.

like image 170
ghostdog74 Avatar answered Dec 09 '22 19:12

ghostdog74