I am running my script in different environments and therefore I store the path and name of program I want to start in variable $CreateSequenceDictionary.
This program uses parameters R= and O= for this reason I put the whole command in quotations “”. Without these, program is started without any paramaters.
And now my problem: instead of $reference I would like to pass content of this variable. I tried this:
"java -jar $CreateSequenceDictionary R=$reference O=output" >mlogfile
and many variations (such as “ “” eval \) with no success.
Please, how should I adjust my command so I could run program stored in variable with parameter stored in variable?
EDIT: If I should use command in terminal, it would look like this:
java -jar /path/CreateSequenceDictionary.jar R=input O=output
However, I want to get name of the program from variable and also name of input file from variable.
You can do that without the surrounding quotes.
Bash will expand the vars before running the command.
If you want to conditionally include the
R=andO=options, you could try something like this:This builds the additional arguments on-the-fly and skips those where the associated
*_optionvariable is empty.