Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
5
Help us understand the problem. What is going on with this article?
@__nagamee

Brace Expansionが便利

More than 5 years have passed since last update.

{}を使うと複合的な連番だったり,部分的に異なる文字列なんかを簡単に生成できます.

$ echo {a..f}{1..9}
a1 a2 a3 a4 a5 a6 a7 a8 a9 b1 b2 b3 b4 b5 b6 b7 b8 b9 c1 c2 c3 c4 c5 c6 c7 c8 c9 d1 d2 d3 d4 d5 d6 d7 d8 d9 e1 e2 e3 e4 e5 e6 e7 e8 e9 f1 f2 f3 f4 f5 f6 f7 f8 f9

$ echo hoge{,5,10}
hoge hoge5 hoge10

# 入れ子もおーけー
$ echo hoge{,_{a,b{,c,d}}}
hoge hoge_a hoge_b hoge_bc hoge_bd

for文で連番つくるときにしか使ったことありませんでしたが,ファイル,ディレクトリ名なんかをうまくこいつで指定してやれば,パスが長かったりで面倒なときにいろいろ楽できそうです.

$ cp hoge{,old}
$ mkdir /home/web/{css,js,img}
5
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
5
Help us understand the problem. What is going on with this article?