[Shell] シェル上で拡張子や連番など名前の一部が異なるファイルを複数生成する
小ネタ。
[markdown]
中括弧 `{}` を使うと楽できると言う話。
`mkdir` でも利用できますね。
連番付きのファイルを作るよ。
桁数も指定するよ。
“`prettyprinted
% touch {01..10}.txt
% ls
01.txt 02.txt 03.txt 04.txt 05.txt 06.txt 07.txt 08.txt 09.txt 10.txt
“`
拡張子が異なるファイルを作るよ。
“`prettyprinted
% touch hello.{html,js,php}
% ls
hello.html hello.js hello.php
“`
ZSH で動かしてます。
“`prettyprinted
% zsh –version
zsh 5.3 (x86_64-apple-darwin16.1.0)
“`
## 補遺
> * [業務で楽するためのUNIXテクニック集 まずはおさらい、シェル制御構造と正規表現の基礎 (1/2):CodeZine(コードジン)](https://codezine.jp/article/detail/3014)
[/markdown]