Unix: Run a command on every subdirectory

In this example I check which local git repositories are up-to-date.

for d in *; do
  if [ -d "$d" ]; then   
    ( cd "$d" && git status )
  fi
done

 

Gareth
Buy Me A Coffee
back arrowBack to Index