Created
May 26, 2015 03:45
-
-
Save kane-c/9b9b89bdf70818d0296a to your computer and use it in GitHub Desktop.
Search all git repos in a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
DIR=`pwd` | |
for project in $(find * -type d -maxdepth 0) | |
do | |
cd $project | |
if [ -d ".git" ] | |
then | |
echo "$bold$project$normal" | |
results=$(git --no-pager grep -EHIin --untracked --color=always "$@" 2> /dev/null) | |
if [ $? == 0 ] | |
then | |
echo $results | |
else | |
echo No results | |
fi | |
echo | |
fi | |
cd $DIR | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment