ayyoob imani ayyoob imani - 1 year ago 112
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?

Answer Source

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 "$@"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download