Skip to content

Instantly share code, notes, and snippets.

@enriched
Created May 2, 2016 19:25
Show Gist options
  • Save enriched/0e4e0231ae650343d3191f12b9562ef5 to your computer and use it in GitHub Desktop.
Save enriched/0e4e0231ae650343d3191f12b9562ef5 to your computer and use it in GitHub Desktop.
Bash for each directory in current folder
# you can add this little gem to your .bash_profile to run a command inside of each directory in the current folder
# eg: foreachdir 'git status'
foreachdir() { /usr/bin/find . -type d -mindepth 1 -maxdepth 1 -exec sh -c "(cd {} && echo '\033[0;31m// '\$PWD'------>\033[0m' && $1)" ';' ; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment