'Bash Quoting Subshell Command Option With Equal Sign
Why is this
function wtf()
{
args="$*"
set -o xtrace
$(some_prog --option="$args") # note the '='
set +o xtrace
}
$ wtf asd asd asd asd
++ some_prog '--option=asd asd asd asd'
not the same as
function wtf2()
{
args="$*"
set -o xtrace
$(some_prog --option "$args") # note no '='
set +o xtrace
}
$ wtf2 asd asd asd asd
++ some_prog --option 'asd asd asd asd'
I believe I am running afoul of item #4 of Simple Command Expansion, but I'm not sure...
For reference, I want the behavior of the latter, to have $args be single-quoted. But I want to be able to use the equals sign, and I don't understand why the initial ' quote from $args is being propagated to the whole of --option=.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
