シェルで知っておくといいこと†
bash†
shopt -s dotglob†
ls *
とかやるとドットファイルも掴みます。
~$ ls * test.txt ~$ shopt -s dotglob ~$ ls * .Xauthority test.txt
shopt -s extglob†
なんかパターンマッチが進化します。
例えば*.txtを渡したいんだけどhoge.txtとfuga.txtは渡したくない!と言ったときにうまく指定できるようになるようです。
[user@localhost test2]$ ls
[user@localhost test2]$ touch {hoge,fuga,piyo,foo,bar}.txt
[user@localhost test2]$ touch shine.bin ouch.exe
[user@localhost test2]$ ls
bar.txt foo.txt fuga.txt hoge.txt ouch.exe piyo.txt shine.bin
[user@localhost test2]$ ls *.txt
bar.txt foo.txt fuga.txt hoge.txt piyo.txt
[user@localhost test2]$ ls !(hoge.txt)
bash: !: event not found
[user@localhost test2]$ shopt -s extglob
[user@localhost test2]$ ls !(hoge.txt)
bar.txt foo.txt fuga.txt ouch.exe piyo.txt shine.bin
[user@localhost test2]$ ls !(?(hoge.txt)?(fuga.txt))
bar.txt foo.txt ouch.exe piyo.txt shine.bin
[user@localhost test2]$ ls !(?(hoge.txt)?(fuga.txt)?(*.txt))
ouch.exe shine.bin
[user@localhost test2]$ ls !(?(hoge.txt)?(fuga.txt)!(?(*.txt)))
bar.txt foo.txt fuga.txt hoge.txt piyo.txt
[user@localhost test2]$ ls !(?(hoge.txt)?(fuga.txt)!(*.txt))
bar.txt foo.txt piyo.txt
[user@localhost test2]$
なんかよくわからないけど!()で除外とか?()で指定とかそんな感じですかねえ...





