Skip to content

Instantly share code, notes, and snippets.

@JackMc
Created May 18, 2014 20:54
Show Gist options
  • Save JackMc/fc955fc1d4977186dfea to your computer and use it in GitHub Desktop.
Save JackMc/fc955fc1d4977186dfea to your computer and use it in GitHub Desktop.
Updates my sources folder
bold=`tput bold`
normal=`tput sgr0`
touch .errors
for d in */
do
echo "Processing $d"
cd "$d"
if [ -d .git ]
then
git pull > /dev/null 2> .error
elif [ -d .svn ]
then
svn update > /dev/null 2> .error
elif [ -d .hg ]
then
hg pull > /dev/null 2> .error
hg update > /dev/null 2> .error
elif [ -d .bzr ]
then
bzr pull > /dev/null 2> .error
fi
if [ -s .error ]
then
a=`cat .error`
echo -e "${bold}$d${normal}:\n$a" >> ../.errors
fi
rm -f .error
cd ..
done
if [ -s .errors ]
then
echo -e "\n${bold}Errors from pulls/updates:${normal}\n"
cat .errors
else
echo -e "\n${bold}Finished with no errors :)${normal}\n"
fi
rm .errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment