This commit is contained in:
Luk Lu
2022-01-09 21:59:30 +08:00
parent 813c2f86ad
commit a9b8c1c863
7 changed files with 49 additions and 42 deletions

View File

@@ -32,25 +32,23 @@ pushd $FONPATH
echo "*** Current path = [`pwd`] ***"
echo ""
for org in `ls | grep -v '~'`
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '~' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
if [ -d $org ]
then
echo "-------- entering [$FONPATH/$org] --------"
echo ""
cd $org;
for repo in `ls .`
do
if [ -d $repo/.git ]
then
echo "git pulling [$FONPATH/$org/$repo]"
cd $repo
git pull --all
echo ""
cd ..
fi
done
cd ..
fi
echo "======== entering [$FONPATH/$org] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
do
if [ -d "$repo/.git" ]
then
echo "---- git pulling [`pwd`/$repo] ----"
cd "$repo"
git pull --all
echo ""
cd ..
fi
done
cd ..
done
popd