Guest User

Untitled

a guest
Dec 15th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!/bin/bash
  2. # Detects all git directories and run their status to identify uncommited changes
  3.  
  4. declare -a dirs=("projects" "work")
  5.  
  6. # runs git status in directory in argument
  7. gitstatus () {
  8. printf "\n\n\t >>> GIT MONITOR >>> "+$1+"\n"
  9. cd $1
  10. cd ..
  11. git status
  12. printf "\n\t=======================================\n"
  13. return 0
  14. }
  15. export -f gitstatus
  16.  
  17. # loop through the directories array
  18. for i in "${dirs[@]}"
  19. do
  20. find ~/$i -type d -name ".git" -print | xargs -n 1 -I {} bash -c 'gitstatus "$@"' _ {}
  21. done
Add Comment
Please, Sign In to add comment