Last active
August 1, 2022 23:31
-
-
Save munzz11/c684e1176aa1f6c3ec6eb1a5556ad63e to your computer and use it in GitHub Desktop.
Recursive command execution through a directory
This file contains hidden or 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
| function recursive_for_loop { | |
| for f in *; do | |
| if [ -d $f -a ! -h $f ]; | |
| then | |
| cd -- "$f"; | |
| echo "Executing in:`pwd`/$f"; | |
| #COMMAND GO HERE | |
| # use recursion to navigate the entire tree | |
| recursive_for_loop; | |
| cd ..; | |
| fi; | |
| done; | |
| }; | |
| recursive_for_loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment