sh脚本应该在文件大小= 0时工作(如果它不下载文件,我手动检查了stat,值为“0”)但它没有停止所以我添加了带有break的“if”语句,仍然不起作用,我怎么能打破它?请帮忙。
注意:可能有其他方法可以自动下载 firefox,但我将 firefox 放在这里只是作为一个轻量级示例。
n=0
mm=22
while [ $n -eq 0 ]; do
for a in $mm
do
for b in 0 1 2 3 4 5 6 7 8 9
do
for c in "" ".1" ".2"
do
wget -O ff.exe http://download.cdn.mozilla.net/pub/firefox/releases/latest/win32/ru/Firefox%20Setup%20$a.$b$c.exe
n=$(stat -c %s ff.exe)
echo "n = $n"
if [ $n -ne 0 ]; then
echo "n2 = $n"
break
fi
done
done
mm=$(( $mm + 1 ))
done
done
好的,我想通了:
n=0
mm=22
while [ $n -eq 0 ]; do
for a in $mm
do
for b in 1 2 0 3 4 5 6 7 8 9
do
if [ $n -ne 0 ]; then
break
fi
for c in "" ".1" ".2"
do
wget -O ff.exe http://download.cdn.mozilla.net/pub/firefox/releases/latest/win32/ru/Firefox%20Setup%20$a.0$c.exe
n=$(stat -c %s ff.exe)
if [ $n -ne 0 ]; then
break
fi
done
done
mm=$(( $mm + 1 ))
done
done