The way projects are organized at my current employer often requires me to run the same command in within the first level of sub-directories.
For example, maybe I have to issue this command in ten sub-directories:
1 |
git pull --rebase |
This little script I wrote helps.
1 2 3 4 5 6 7 8 9 10 |
#!/bin/bash echo "input command to run on all sub-directories: "; read command; for directory in ./*/; do echo $directory $command; cd $directory; $command; cd -; done |