Paste #1277
Welcome On LodgeIt
Welcome to the LodgeIt pastebin. In order to use the notification feature a 31 day cookie with an unique ID was created for you. The lodgeit database does not store any information about you, it's just used for an advanced pastebin experience :-). Read more on the about lodgeit page. Have fun :-)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/bin/bash
# set dotglob to get hidden directories with *
shopt -s dotglob
# cat all arguments to one string
command="$@"
recursivegit() {
for d in */; do
if [ -d $d ]; then
(cd $d; recursivegit)
fi
for f in $d; do
if [ -d $f ]; then
if [ "$f" == ".git/" ]; then
output="$(git $command)"
if [ ! -z "$output" ]
then
echo "#### Repo:" `pwd`
echo -e "$output \n"
fi
return
fi
fi
done
done
}
if [ $# -lt 1 ]; then
echo "Usage: $0 <git command> [<options>]"
exit
fi
# strip the git from the commandline if given
if [ "$1" == "git" ]; then
command=${command#git}
fi
# go recursive
recursivegit
|