Compare:

   for a in "$(echo 1 2)"; do echo "x${a}x"; done
x1 2x
   for a in  $(echo 1 2) ; do echo "x${a}x"; done
x1x
x2x

   a="$(echo 1 2)"; echo "x${a}x"
x1 2x
    a=$(echo 1 2);  echo "x${a}x"
x1 2x



Shell quoting is difficult enough; why is such an inconsistency making
it even more confusing?

Uwe Waldmann might give a clue in his excellent "Guide to Unix shell
quoting":

   Note that in these [assignment + others] cases, the shell syntax
   allows only a single word, not a sequence of words, so that blank
   interpretation or expansion of globbing characters might result in
   something syntactically illegal.

In other words:

   In order to save you from some very obvious syntax errors, I'll
   make quoting even more confusing than it already is.

Sorry but I am not grateful at all.

Or is there a better rationale for this design?



Reply via email to