I have to use a bash script (I'm not familiar with bash) for submitting a HPC job. The job-submission script template sets the command and options and then combines them in the end:
input="file_name"
name="simulation1"
application=my_app
options="in=$input.h5 out=$name.h5 param1=foo"
cmd="$application $options"
this all works okay, i.e. eval $cmd
executes
my_app in=$input.h5 out=$name.h5 param1=foo
until I need the character '>' in the options. In particular, I want to add the option absrad="mass>1?H:0"
, but if I simply set
options="in=$input.h5 out=$name.h5 param1=foo absrad=mass>1?H:0"
then bash truncates that at the '>', so that eval $cmd
executes
my_app in=$input.h5 out=$name.h5 param1=foo absrad=mass
instead. How to fix that such that eval $cmd
executes
my_app in=$input.h5 out=$name.h5 param1=foo absrad="mass>1?H:0"
EDIT. Note that this is similar to, but not a duplicate of this post, where a single-quoted argument is the problem. Moreover, the answers there only consider solutions using an array for the options. I would like alternatives w/o array.