ayyoob imani ayyoob imani - 2 months ago 4x
Linux Question

how to set number of jobs for GNU parallel in my script

In the following script I want to explicitly set number of concurrent jobs to run the command:

#!/usr/bin/parallel -j 2 --shebang-wrap /bin/bin
echo hi "$@"

when I run the script, I get the following error:
parallel: Error parsing of --jobs/-j/--max-proc/-P failed

any Idea on how to set number of jobs when making an existing script parallel?


From the man page:

--shebang-wrap must be set as the first option.

This should work:

#!/usr/bin/parallel --shebang-wrap -j 2 /bin/bash
echo hi "$@"