Skip to main content
added 480 characters in body
Source Link
cas
  • 85.1k
  • 9
  • 139
  • 207

You need to quote the entire command being run by parallel, for example:

$ parallel 'echo $((2**{}))' ::: {5..10} 32 64 128 256 512 1024 

Actually, just quoting the bash arithmetic part of the command works too:

$ parallel echo '$((2**{}))' ::: {5..10} 32 64 128 256 512 1024 

The reason is that without quotes, bash will try to expand & evaluate the arithmetic before passing it to parallel, and 2**{} doesn't mean anything to bash. The error message is actually from bash, not parallel:

$ echo $((2**{})) -bash: 2**{}: syntax error: operand expected (error token is "{}") 

You need to quote the entire command being run by parallel, for example:

$ parallel 'echo $((2**{}))' ::: {5..10} 32 64 128 256 512 1024 

You need to quote the entire command being run by parallel, for example:

$ parallel 'echo $((2**{}))' ::: {5..10} 32 64 128 256 512 1024 

Actually, just quoting the bash arithmetic part of the command works too:

$ parallel echo '$((2**{}))' ::: {5..10} 32 64 128 256 512 1024 

The reason is that without quotes, bash will try to expand & evaluate the arithmetic before passing it to parallel, and 2**{} doesn't mean anything to bash. The error message is actually from bash, not parallel:

$ echo $((2**{})) -bash: 2**{}: syntax error: operand expected (error token is "{}") 
Source Link
cas
  • 85.1k
  • 9
  • 139
  • 207

You need to quote the entire command being run by parallel, for example:

$ parallel 'echo $((2**{}))' ::: {5..10} 32 64 128 256 512 1024