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.
More Related Contents:
- Delete files older than 10 days using shell script in Unix [duplicate]
- What does 2>&1 mean here?
- How can I check if a directory exists in a Bash shell script?
- Difference between sh and Bash
- Pass commands as input to another command (su, ssh, sh, etc)
- Why do you need ./ (dot-slash) before executable or script name to run it in bash?
- Bash tool to get nth line from a file
- Bash command line and input limit
- Which characters need to be escaped when using Bash?
- “~/Desktop/test.txt: No such file or directory”
- How to suppress Terminated message after killing in bash?
- “Invalid Arithmetic Operator” when doing floating-point math in bash
- Copy folder recursively, excluding some folders
- Variable interpolation in the shell
- find: missing argument to -exec
- How do I pause my shell script for a second before continuing?
- Is there a way to make bash job control quiet?
- What does ” 2>&1 ” mean?
- Bash regex =~ operator
- How do I check if a directory exists or not in a Bash shell script?
- Print a file’s last modified date in Bash
- Validate date format in a shell script
- How can I convert tabs to spaces in every file of a directory?
- Convert Unix timestamp to a date string
- Using Bash to display a progress indicator (spinner) [duplicate]
- Extract version number from a string
- How to properly nest Bash backticks
- How to include nohup inside a bash script?
- How to wait on all child (and grandchild etc) process spawned by a script
- Subtract two variables in Bash