循环时限制bash到10次重试

前端之家收集整理的这篇文章主要介绍了循环时限制bash到10次重试前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这个while循环如何限制为最多10次重试?
#!/bin/sh
while ! test -d /somemount/share/folder
do
    echo "Waiting for mount /somemount/share/folder..."
    sleep 1
done
保持柜台:
#!/bin/sh

while ! test -d /somemount/share/folder
do
    echo "Waiting for mount /somemount/share/folder..."
    ((c++)) && ((c==10)) && break
    sleep 1
done

猜你在找的Bash相关文章