Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Detects all git directories and run their status to identify uncommited changes
- declare -a dirs=("projects" "work")
- # runs git status in directory in argument
- gitstatus () {
- printf "\n\n\t >>> GIT MONITOR >>> "+$1+"\n"
- cd $1
- cd ..
- git status
- printf "\n\t=======================================\n"
- return 0
- }
- export -f gitstatus
- # loop through the directories array
- for i in "${dirs[@]}"
- do
- find ~/$i -type d -name ".git" -print | xargs -n 1 -I {} bash -c 'gitstatus "$@"' _ {}
- done
Add Comment
Please, Sign In to add comment