「ShellScript」while文のサンプル
書式
while [ 条件 ]
do 処理コード done
使用例
#!/bin/sh
x=11
while [ $x -lt 15 ]
do
echo $x
x=`expr $x + 1`
done
#!/bin/sh
x=11
while [ $x -lt 15 ]
do
echo $x
x=`expr $x + 1`
done
#!/bin/sh x=11 while [ $x -lt 15 ] do echo $x x=`expr $x + 1` done
実行結果
$ sh test06.sh
11
12
13
14