I have the following piece of code:
options=" -cm '${someVariable} -someOption'"
echo "test ${options}"
${var1} doSomething -af ${var2} ${options}
The second line makes sure $options
contains what I want. The output is correct (note there is only 2 single quotes and their position is correct):
test -cm 'abc -someOption'
The problem comes when $options
is added to the third line, which runs the command itself. Bash adds more quotes to it, some being in the middle of the string:
var1 doSomething -af /path/path -cm ''\''abc' '-someOption'\'''
The output I'd like is:
var1 doSomething -af /path/path -cm 'abc -someOption'
I tried all kinds of combinations with simple and double quotes, but none work.