gpt4 book ai didi

zsh - (zsh 大括号扩展 | seq) 用于字符列表 - 如何?

转载 作者:行者123 更新时间:2023-12-03 21:13:18 25 4
gpt4 key购买 nike

Bash 允许我编写语句,

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

但是 zsh 只允许数字列表扩展,例如 {8..13} .

最好的解决方法是什么?像字符的 seq 之类的东西......

最佳答案

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

来自 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.

关于zsh - (zsh 大括号扩展 | seq) 用于字符列表 - 如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2394728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com