我的脚本中有一个 while 循环,它等待连接上线然后继续。
#!/bin/sh while ! ping -c1 $1 &>/dev/null do echo "Ping Fail - `date`" done echo "Host Found - `date`"
重新连接需要 25 到 45 秒。我不能让它等待超过 50 秒。限制循环工作时间的最佳解决方案是什么?
command-line scripting bash shell-script
bash ×1
command-line ×1
scripting ×1
shell-script ×1