Last active
September 7, 2018 15:31
-
-
Save lxhunter/16d0074385332575484e3a9678af9d28 to your computer and use it in GitHub Desktop.
Executing command in all direct sub directories
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 | |
for directory in *; do | |
if [ -d "${directory}" ]; then | |
echo "${directory}:" | |
( | |
cd "${directory}" | |
exec "${@}" | |
) | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be used like so:
It takes the command as arguments
BE CAREFUL!