(reply below) On 18.06.20 at 19:49, Miriam Dixon wrote: > parallel runSim.sh --projAngles {1} ::: 0 45 90 135 > > This seemed to work, in that it started my runSim.sh, but it didn't > use the value from projAngles within the script, > time=$(bc -l <<< "$projAngles*$timePerProjection") > > Is there a way in the script or in parallel to insert the particular > projAngles value for that run, and use it to calculate the next step?
Hi Miriam, Your 'parallel' command seems perfectly fine (you /could/ leave out the "1" in the "{}" as it's optional when there's only one argument, but that's up to you). Perhaps it's a shell scripting error? Doing my best to imagine what the inside of your 'runSim.sh' script might look like, I came up with this: #!/bin/bash timePerProjection=10 projAngles=${2:?Missing argument} time=$(bc -l <<< "$projAngles*$timePerProjection") echo $time And running Parallel 20200122, I get (what I expected to be) the proper result $ parallel ./runSim.sh --projAngles {1} ::: 0 45 90 135 0 450 900 1350 It might help to just put echo $projAngles exit somewhere early on in your script, just so you can be sure that the variable is being assigned properly given the option to the '--projAngles' command-line argument. Also, adding 'set -u' at the top of your script will cause it to terminate (with an error message) any time a variable is used without being defined first. I add this to the top of all of my Bash scripts, for sanity's sake. Lastly, as an aside, I find the '--dry-run' option to Parallel itself really handy when I'm preparing to run something with Parallel. Hope this helps. —Kevin