如何在bash脚本里面进行循环 #!/bin/bash n=9999 for(( i =1; i<=100;i++)) do /root/testProgram $n sleep 5 n=$((n+1)) done REFER: How to increment a variable in bash?…
while do done, until do done (不定循环) while [ condition ] <==中括号内的状态就是判断式 do <==do 是回圈的开始! 程序段落 done <==done 是回圈的结束 until [ condition ] do 程序段落 done [root@www scripts]# vi sh13.sh #!/bin/bash # Program: # Repeat question until user input correct an…
写在前面:案例.常用.归类.解释说明.(By Jim) for命令重复一系列的命令是一种常见的编程实践. #!/bin/bash # basic for command for test in A B C D E F G H I J K L M N O P Q do echo The next letter is $test done 结果:The next letter is AThe next letter is BThe next letter is CThe next letter is…