方法一: while循环,用的比较多的 #!/bin/bash set j= while true do let "j=j+1" echo "----------j is $j--------------" done 方法二: for ,看到这个用法时,看来是真真了解了for的含义 #!/bin/bash set i= set j= ;i<;)) do let "j=j+1" echo "-------------j is $j…
for #!/bin/bash ;i<;)) do let "j=j+1" echo "-------------j is $j -------------------" done while #!/bin/bash while(true) do let "j=j+1" echo "----------j is $j--------------" done…
写出 shell 脚本中所有循环语法 for 循环 : for i in $(ls);do echo item:$i done while 循环 : #!/bin/bash COUNTER=0 while [ $COUNTER -lt 10 ]; do echo The counter is $COUNTER let COUNTER=COUNTER+1 done until 循环 : #!/bin/bash COUNTER=20 until [ $COUNTER -lt 10 ]; do ech…
centos shell脚本编程2 if 判断 case判断 shell脚本中的循环 for while shell中的函数 break continue test 命令 第三十六节课 return用在函数中exit用在shell当中 直接退出整个脚本,整个子shell或当前shellbreak退出循环 上半节课 if 判断case判断shell脚本中的循环 下半节课 for whileshell中的函数breakcontinue 课程大纲(继续上节课的) 7. if…