当前位置:   article > 正文

shell之repo/git下载源码断后重新下载(三)_git clone 继续下载

git clone 继续下载

1.shell之repo/git下载源码断后重新下载 

  1. 方案1:
  2. #!/bin/bash                      
  3. while [ 1 ]
  4.  do
  5.     echo "Enter infinity loop.... "
  6.     if [ ! -d emacs ];then#如果下载断了就会删除emacs目录,此时判断如果不存在emacs目录,就一直会继续执行下载命令。
  7.         echo "Enter emacs download...."                   
  8.         git clone https://github.com/zgj224/emacs
  9.     fi
  10.     sleep 1
  11.   if [ -d emacs ]; then
  12.         echo "Download is success...."
  13.         break;
  14.   fi
  15. done
  16. 方案2:
  17. #!/bin/bash                                                                   
  18. echo "======start repo sync======"
  19. git clone https://github.com/zgj224/emacs # 第一次下载android源代
  20. while [ $? != 0 ]
  21. do
  22.     echo "======sync failed, re-sync again======"
  23.     sleep 2
  24.     git clone https://github.com/zgj224/emacs #  如果出错,隔2秒后回继续调用repo sync下载android源代码
  25. done
  26. 注意:其中"$?"可以获取shell最近一次的执行状态,如果成功,返回0,否则返回非0的数字。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/847617?site
推荐阅读
相关标签
  

闽ICP备14008679号