方案1:
#!/bin/bash ? ? ? ? ? ? ? ? ? ? ?
while [ 1 ]doecho "Enter infinity loop.... "if [ ! -d emacs ];then#如果下載斷了就會刪除emacs目錄,此時判斷如果不存在emacs目錄,就一直會繼續執行下載命令。echo "Enter emacs download...."? ? ? ? ? ? ? ? ? ?git clone https://github.com/zgj224/emacsfisleep 1if [ -d emacs ]; thenecho "Download is success...."break;fi
done方案2:
#!/bin/bash? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
echo "======start repo sync======"
git clone https://github.com/zgj224/emacs?# 第一次下載android源代
while [ $? != 0 ]
doecho "======sync failed, re-sync again======"sleep 2git clone https://github.com/zgj224/emacs?#? 如果出錯,隔2秒后回繼續調用repo sync下載android源代碼
done
注意:其中"$?"可以獲取shell最近一次的執行狀態,如果成功,返回0,否則返回非0的數字。
?
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态