bashでfor文はとても便利。
for inを使う
https://gist.github.com/daipresents/b8ecd21e7647f04740239a0ca6dd6f92.js?file=for-in.txt
lsを使ってディレクトリにあるファイル名でループ
https://gist.github.com/daipresents/b8ecd21e7647f04740239a0ca6dd6f92.js?file=for-in-ls.txt
lsをさらに応用して拡張子txtだけループ
https://gist.github.com/daipresents/b8ecd21e7647f04740239a0ca6dd6f92.js?file=for-in-ls-grep.txt
ワンライナー
https://gist.github.com/daipresents/3235658b75015ab2da47b31eba3959fc.js
catでファイルを読み込んで処理するループ
https://gist.github.com/daipresents/b8ecd21e7647f04740239a0ca6dd6f92.js?file=for-in-cat.txt
空の行が読み飛ばされているのが素敵。
catでファイルを読み込んで処理するループその2
https://gist.github.com/daipresents/b8ecd21e7647f04740239a0ca6dd6f92.js?file=for-in-cat-2.txt
これも空の行が読み飛ばされ、半角スペースごとにループしている。
配列をつかってループ
https://gist.github.com/daipresents/b8ecd21e7647f04740239a0ca6dd6f92.js?file=for-in-array.txt