I am executing the command foo --bar "" --baz, i.e. I'm calling foo with three arguments:
- --bar
- an empty string
- --baz
This works.
Now, I would like to store that parameter sequence in a shell variable before passing it to foo (because I'm calling foo dozens of time with a varying list of parameters and I want that variable to hold the parameters common to all invocations), something along the lines of
PARAMS='--bar "" --baz'; foo ${PARAMS}
But I can't find a way to do that in a way that preserves all three parameters including the empty one. For example, the version above will pass three parameters to foo, but the middle one will be the string "" (two double quotes) instead of an empty string.
Other approaches I tested where:
- PARAMS="--foo \"\" --bar"; foo ${PARAMS}also turns the second parameter into the string- ""
- PARAMS="--foo --bar"; foo ${PARAMS}removes the second parameter
- PARAMS="--foo --bar"; foo "${PARAMS}"coalesces the parameters into a single one- --foo --bar
 
     
     
     
    