How do I write a bash script that goes through each directory inside a parent_directory and executes a command in each directory
This answer posted by Todd helped me.
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && pwd" \;
The \( ! -name . \) avoids executing the command in current directory.
\( ! -name . \)