【シェルスクリプト】ループ処理:while【使用例紹介】
備忘録になります。
# cat wrk.sh
COUNT=0
while [ $COUNT -le 5 ] ; do
echo "COUNT: $COUNT"
COUNT=`expr $COUNT + 1`
done
# ./wrk.sh
COUNT: 0
COUNT: 1
COUNT: 2
COUNT: 3
COUNT: 4
COUNT: 5
関連リンク
備忘録になります。
# cat wrk.sh
COUNT=0
while [ $COUNT -le 5 ] ; do
echo "COUNT: $COUNT"
COUNT=`expr $COUNT + 1`
done
# ./wrk.sh
COUNT: 0
COUNT: 1
COUNT: 2
COUNT: 3
COUNT: 4
COUNT: 5