re: My Shell Workflow: Executing a command in lots of directories. VIEW POST

VIEW FULL DISCUSSION
 

Very nearly the same, here's my "inall" script:

$ cat ~/bin/inall
#!/bin/sh
# runs given command (all arugments) in each directory of pwd
# example: in a workspace directory with many subfolders:
# $ inall git status

echo $@
for dir in ${PWD}/*
do
    if [ -d $dir ]; then
        echo ""
        echo "$dir"
        cd $dir && $@
        cd - > /dev/null
    fi
done
 
code of conduct - report abuse