I don't see the point of the first part of this answer. First you correctly notice that
{"-c root."}
in {"-c root."}{foo,bar,baz}
does not expand, then you deal with this "problem" by introducing {"-c root.",#}
which gives you words that start with #
. They are not comments (your echo
did print them), unless you eval
the result. It so happens eval
is a "solution" to the problem of -c root.foo
being a single word, but the OP had this exact problem from -c\ root.{foo,bar,baz}
. Why don't we just eval
this? Why complicate things with the additional brace expansion and #
?