コード例:
#!/bin/bash
for i in {1..5}
do
echo "Number is $i"
done
実行例:
#
#cat example.sh
#!/bin/bash
for i in {1..5}
do
echo "Number is $i"
done
#
#./example.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)