memecs
memecs

Reputation: 7564

Executing GNU Parallel within a script

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?

Upvotes: 5

Views: 1671

Answers (1)

user000001
user000001

Reputation: 33317

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

Upvotes: 6

Related Questions