分类: LINUX
2018-03-17 09:58:39
##
printf "example 1:\n"
for ((i = 0; i < 10; i++))
do
printf "${i} "
done
printf "\n\n"
执行结果:
example 1:
0 1 2 3 4 5 6 7 8 9
##
printf "example 2:\n"
for i in $(seq 1 10)
do
printf "$i "
done
printf "\n\n"
执行结果:
example 2:
1 2 3 4 5 6 7 8 9 10
##
printf "example 3:\n"
for i in {1..10}
do
printf "${i} "
done
printf "\n\n"
执行结果:
example 3:
1 2 3 4 5 6 7 8 9 10
##
printf "loop in string\n"
printf "example 4:\n"
for i in `ls`
do
printf "${i} "
done
printf "\n\n"
执行结果:
example 4:
check_source.sh for.sh if.sh packet.sh readline.sh script shell1.sh shell.sh string_compare.sh svn.sh version_config.txt
##
printf "example 5:\n"
for i in f1 f2 f3
do
printf "${i} "
done
printf "\n\n"
执行结果:
example 5:
f1 f2 f3