Question

The command parallel echo {} ::: A B C executed from the command line return the correct result, while when invoked within a bash script return the error:

This is the script:

#script.bash
#!/usr/bin/env bash

parallel echo {} ::: A B C

This is the output:

bash script.bash
/bin/bash: {}: command not found
/bin/bash: ::: command not found
/bin/bash: A: command not found
/bin/bash: B: command not found
/bin/bash: C: command not found

Any idea why and how to correctly call GNU parallel within a bash script?

Was it helpful?

Solution

Apparently the --tollef switch (that does not support the ::: syntax) gets enabled when you run it from a script.

You can fix it either by enabling the --gnu switch as with

parallel --gnu echo {} ::: A B C
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top