This script executes the command specified by -e in the directories dir1, dir2, etc. By setting the maximum number of workers using -n to a value larger than 1, the calculations are done in parallel. This script is particularly useful in running e.g. climate models in parallel.

  execute_parallel [OPTION] dir1 dir2 ...

  where OPTION:
     -h          this message
     -n          set the maximum number of workers (default: 1)
     -v          verbose, program provides feedback (default: false)
     -l          set logging directory (default: log)
     -e          bash command that needs to run in the directory (e.g. 'python')


     execute_parallel -e "ls -al" dir1 dir2
     execute_parallel -e "ls -al" dir*
     execute_parallel -e "ls -al" -v dir*

GPL license, Paul Hiemstra (