LoginSignup
3
3

More than 5 years have passed since last update.

Zshで1文字のリストを展開する(brace_cclの話)

Last updated at Posted at 2014-08-04

Zsh で setopt brace_ccl すると {} の展開されるルールが拡張され、

$ unsetopt brace_ccl
$ echo hoge{1234a-c}
hoge{1234a-c}

$ setopt brace_ccl
$ echo hoge{1234a-c}
hoge1 hoge2 hoge3 hoge4 hogea hogeb hogec

みたいになる(正規表現の [1234a-c] みたいな書き方に似てる)。

  • 他のルールに適合しない限り、1文字ずつ展開する。
    • {1..20} や {1,2,3} などで解釈できる場合はそちらの挙動が優先される
  • 範囲指定は - で行う。

参考

  • zshexpn(1) BRACE EXPANSION
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3