对多个git目录批量更新

对多个git目录批量执行 git pull

使用linux shell

#!/bin/bash
dir222="$1"
echo "$dir222"
## check  whether file exists
if [ -f $dir222 ]; then
    echo "请传递要扫描的目录:"
    exit 0
fi

## method must be added before where is invoked
gilPul()
{
    echo "----------------------"
    filepath2="$1"
    echo $filepath2
    cd "$filepath2"
    git pull
}
## get all folder in "$dir222"
for i in `ls "$dir222"`;do
#    echo "current path:`pwd`"
    cd "$dir222"
    if [ -d $i ];then
        gilPul "$i"
    fi
done

注意

  1. linux shell 函数 必须在使用前声明;
  2. 获取函数的第一个参数: $1
  3. 判断是否是目录 :test -d <路径>

转载于:https://my.oschina.net/huangweiindex/blog/1943995

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值