forked from ahurac/dotfiles
updateall : parallélisation du script git
This commit is contained in:
parent
c6a602dbda
commit
f1c20f51dd
1 changed files with 16 additions and 10 deletions
|
@ -1,12 +1,18 @@
|
|||
#!/bin/sh
|
||||
if cd ~/git; then
|
||||
for repo in *; do
|
||||
cd "$repo" || continue
|
||||
printf '\n%s\n' "$repo"
|
||||
git pull
|
||||
cd ..
|
||||
done
|
||||
else
|
||||
>&2 echo "Can't find your git folder!"
|
||||
fi
|
||||
|
||||
update_repo() {
|
||||
cd "$1" || return
|
||||
printf 'Updating repository \033[1m%s\033[0m...\n' "$1"
|
||||
git pull
|
||||
}
|
||||
|
||||
cd ~/git || exit
|
||||
|
||||
for i in *; do
|
||||
while [ "$(jobs -p | wc -l)" -ge 4 ]; do
|
||||
sleep 1
|
||||
done
|
||||
update_repo "$i" &
|
||||
done
|
||||
|
||||
wait
|
||||
|
|
Loading…
Reference in a new issue