for:
#打印123for i in { 1,2,3}; do echo -n $idone#打印abcdfor i in { a..d}; do echo -n $idone#可以用这种循环方式for ((i=0; i<10; i++)){ echo $i}
while:
i=5while [ $i -gt 3 ]; do echo $i let i--done
until:
i=5until [ $i -eq 7 ]do echo $i; let i++done
if:
if [ 3 -lt 2 ]; then echo "3<2"elif [ 3 -gt 2 ]; then echo "3>2"else echo "3==2"fi#组合多个条件:if [[ "a" == "a" ]] && [ 3 -eq 2 ]; then echo "T"; else echo "F"; fi#使用test测试条件:if test 3 -eq 3; then echo "T"; fi