Skip to content

Instantly share code, notes, and snippets.

@numeroSette
Last active September 20, 2021 16:46
Show Gist options
  • Save numeroSette/a9aad8d520f92d185b98d52044b1f4ce to your computer and use it in GitHub Desktop.
Save numeroSette/a9aad8d520f92d185b98d52044b1f4ce to your computer and use it in GitHub Desktop.
#!/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