tempad
ReadyGo!技术成就梦想 >>Shell教程 >> Linux程式设计-11.ShellScript(bash)--(10)控制圈while/until

Linux程式设计-11.ShellScript(bash)--(10)控制圈while/until

ReadyGo!技术成就梦想 网络搜索 efish 2008-2-24 2:50:08
whilelistdolistdone
当list为True时,该圈会不停地执行。
例一:无限回圈写法
#!/bin/sh

while:;do
echo"dosomethingforeverhere"
sleep5
done

例二:强迫把pppd杀掉。
#!/bin/sh

while;do
killallpppd
done



--------------------------------------------------------------------------------

untillistdolistdone
当list为False(non-zero)时,该圈会不停地执行。
例一:等待pppd上线。
#!/bin/sh
until;do
sleep1
done
责任编辑: efish 参与评论 查找更多:
相关文章
Linux程式设计-11.ShellScript(bash)--(11)参数与变数 Linux程式设计-11.ShellScript(bash)--(11)参数与变数
Linux程式设计-11.ShellScript(bash)--(13)Bash内建… Linux程式设计-11.ShellScript(bash)--(13)Bash内建指令集
Linux程式设计-11.ShellScript(bash)--(12)函数func… Linux程式设计-11.ShellScript(bash)--(12)函数function
Linux程式设计-11.ShellScript(bash)--(14)Bash内建… Linux程式设计-11.ShellScript(bash)--(14)Bash内建参数
Linux程式设计-11.ShellScript(bash)--(15)提示符号 Linux程式设计-11.ShellScript(bash)--(15)提示符号
Linux程式设计-11.ShellScript(bash)--(16)算术表述 Linux程式设计-11.ShellScript(bash)--(16)算术表述
Linux程式设计-11.ShellScript(bash)--(17)重导Redi… Linux程式设计-11.ShellScript(bash)--(17)重导Redirection
Linux程式设计-11.ShellScript(bash)--(18)语法 Linux程式设计-11.ShellScript(bash)--(18)语法
Shell递归程序设计-目录列表 Shell递归程序设计-目录列表
写shellscript时,要如何从terminal读入字元? 写shellscript时,要如何从terminal读入字元?
2秒记住本站域名

玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的ReadyGo.com.cn

分类导航
ReadyGo!技术成就梦想