每五秒运行一个命令且出错后退出的脚本
时间:2014-06-23 02:22 来源:linux.it.net.cn 作者:IT网
每五秒运行一个命令且出错后退出的脚本,有需要的朋友可以参考下。
#!/bin/bash
while true
do
ls -al;
if [ $? != "0" ]; then
echo " occure errors "
exit
fi
echo "sleep 5s";
sleep 5s;
done
(责任编辑:IT)
每五秒运行一个命令且出错后退出的脚本,有需要的朋友可以参考下。 #!/bin/bash while true do ls -al; if [ $? != "0" ]; then echo " occure errors " exit fi echo "sleep 5s"; sleep 5s; done (责任编辑:IT) |