bashでsingle line inifinite while loopを実行し、条件付きのループで1行追加しようとしました。以下は私のコマンドに言及しましたが、予期せぬ結果をもたらします(2回の反復後に停止すると考えられますが、決して停止しません。また変数Iも実行可能とみなします)。単一行のBash whileループの構文
コマンド:
i=0; while [ $i -lt 2 ]; do echo "hi"; sleep 1; i = $i + 1; done
出力:
hi
The program 'i' is currently not installed. To run 'i' please ....
hi
The program 'i' is currently not installed. To run 'i' please ....
hi
The program 'i' is currently not installed. To run 'i' please ....
...
...
注:私はUbuntuの14.04
特定の値の 'i'をループしている場合、whileループは必要ありません。あなたは欲しい: 'for((i = 0; i <2; i ++));行う ... ; done' –