ファイルの先頭または末尾に空白行があるすべてのファイルを一覧表示する bashスクリプトを見つけました。
for f in `find . -type f`; do
for t in head tail; do
$t -1 $f |egrep '^[ ]*$' >/dev/null && echo "blank line at the $t of $f" ;
done;
done
出力をファイルに渡したいと思います。echo
行を次のように変更しました。
$t -1 $f |egrep '^[ ]*$' >/dev/null && echo "blank line at the $t of $f" > blank_lines.log
しかし、これはうまくいきませんでした。
&&
シンボルの機能と、上記の行が出力をファイルに渡さない理由をお聞きしたいと思います。