shell脚本批量调用git命令

有时候想对本地的几个repository都进行一下pull,一个一个操作比较繁琐,所以写了个shell脚本进行简化操作。

  1. git_pull_all.sh

     #!/bin/sh
     clear
     
     function showMsg()
     {
       echo -e "33[32m$133[0m"
     }
     
     lstRepo=(
       Project01
       Project02
       Project03
       Project04
     )
     for repo in ${lstRepo[@]}
     do
       cd ../$repo
       showMsg '开始git pull '$repo
       git pull
     done
    
  2. start_pull.sh

     #!/bin/sh
     clear
     
     ./git_pull_all.sh
     
     echo
     echo
     echo
     echo
     echo -e "33[32m=====================================33[0m"
     echo -e "33[32mPress any key to exit 33[0m"
     echo -e "33[32m=====================================33[0m"
     read
原文地址:https://www.cnblogs.com/liqipeng/p/4895937.html