Last active
September 20, 2021 16:46
-
-
Save numeroSette/a9aad8d520f92d185b98d52044b1f4ce to your computer and use it in GitHub Desktop.
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/bash | |
# https://www.baeldung.com/linux/execute-command-directories | |
function recursive_for_loop { | |
for f in *; do | |
if [ -d $f -a ! -h $f ]; | |
then | |
cd -- "$f"; | |
echo "Doing something in folder `pwd`/$f"; | |
# 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