Last active
April 25, 2022 15:21
-
-
Save vagnerlandio/1a18abce69e9201081dc9ddb7b754cc4 to your computer and use it in GitHub Desktop.
Execute command in all immediate subdirectories
This file contains hidden or 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/zsh | |
# A simple script with a function... | |
mexec() | |
{ | |
export THE_COMMAND=$@ | |
find . -type d -maxdepth 1 -mindepth 1 -print0 | xargs -0 -I{} zsh -c 'cd "{}" && echo "*\033[1;32mstart {} start\033[0m*" && echo "$('$THE_COMMAND')" && echo -e "*\033[1;93mend {} end\033[0m*\n"' | |
} | |
mexec ls -al |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment