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

后端 未结 2 1083
太阳男子
太阳男子 2020-12-13 10:54

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

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 11:44

    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.

提交回复
热议问题