bash for ループ

estis2014/10/07 (火) 20:58 に投稿
$ for i in 1 2 3 4
> do
> echo $i
> done
1
2
3
4
$ for i in {1..4}
> do
> echo $i
> done
1
2
3
4
$ for ((i=1; i<=4; i++))
> do
> echo $i
> done
1
2
3
4
$ for i in $(seq 1 4)
> do
> echo $i
> done
1
2
3
4
$ array=(1 2 3 4); for i in "${array[@]}"
> do
> echo $i
> done
1
2
3
4

Comments