Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
いくつかのファイルを読み取るループを作成し、wc出力が5より小さい場合にループを停止したい。この場合、ファイル「file」には、処理されるファイルの名前が含まれています。
for i in `cat file` do echo printing $i ... a=`wc $i` while [ $a -gt 5 ] do echo 3 sleep 10 done done
この部分は機能していません
a=`wc $i` while [ $a -gt 5 ]
wc -lファイルの行数を取得するために使用する予定です。また、無限ループが発生しないように、$aをデクリメントする必要があります。
wc -l
a=$(wc -l $i|awk '{print $1}')
これを試して?