コード例:
#!/bin/bash
i=1
while [ $i -le 5 ]
do
echo "Number is $i"
i=$(( i+1 ))
done
実行例:
#
#cat examples.sh
## コード例
#!/bin/bash
i=1
while [ $i -le 5 ]
do
echo "Number is $i"
i=$(( i+1 ))
done
#
#./examples.sh
Number is 1
Number is 2
Number is 3
Number is 4
Number is 5
#
環境:
- AlmaLinux release 8.4 (Electric Cheetah)
- GNU bash, バージョン 4.4.19(1)-release-(x86_64-redhat-linux-gnu)