bash并行循环

bash并行循环,bash,gnu-parallel,Bash,Gnu Parallel,我正在尝试并行运行此脚本,因为我您不需要为循环使用。您可以这样使用find: find . -mindepth 1 -maxdepth 1 -type d ! -print0 | parallel -0 --jobs 4 'cd {}; python3 ~/bin/runspr.py SCF' 另一种可能的解决办法是: find . -mindepth 1 -maxdepth 1 -type d ! -print0 | xargs -I {} -P 4 sh -c 'cd {}; python

我正在尝试并行运行此脚本,因为我您不需要为循环使用
。您可以这样使用
find

find . -mindepth 1 -maxdepth 1 -type d ! -print0 |
parallel -0 --jobs 4 'cd {}; python3 ~/bin/runspr.py SCF'

另一种可能的解决办法是:

find . -mindepth 1 -maxdepth 1 -type d ! -print0 |
xargs -I {} -P 4 sh -c 'cd {}; python3 ~/bin/runspr.py SCF'

也可以试试:
parallel'cd{};python3~/bin/runspr.py SCF':*/
find . -mindepth 1 -maxdepth 1 -type d ! -print0 |
xargs -I {} -P 4 sh -c 'cd {}; python3 ~/bin/runspr.py SCF'