Hi Peff,

On Thu, 28 Jun 2018, Jeff King wrote:

> On Thu, Jun 28, 2018 at 10:27:32AM -0700, Junio C Hamano wrote:
> 
> > Johannes Schindelin <johannes.schinde...@gmx.de> writes:
> > 
> > >> I.e.:
> > >> 
> > >>   FOO='with spaces'
> > >>   BAR=$FOO sh -c 'echo $BAR'
> > >> 
> > >> works just fine.
> > >
> > >   $ x="two  spaces"
> > >
> > >   $ echo $x
> > >   two spaces
> > >
> > > Maybe we should quote a little bit more religiously.
> > 
> > Both of you are wrong ;-)

Technically, you did not contradict anything I said.

> > Of course, the lack of dq around echo's argument makes shell split
> > two and spaces into two args and feed them separately to echo, and
> > causes echo to show them with a single SP in between.  Peff's
> > exampel should have been
> > 
> >     BAR=$FOO sh -c 'echo "$BAR"'
> 
> Yes, that's a better example. I was primarily trying to show that the
> outer shell did not barf with "spaces: command not found".
> 
> > But that does not have much to do with the primary point Peff was
> > talking about, which is that in this sequence:
> > 
> >     $ x="two  spaces"
> >     $ y="$x"
> >     $ z=$x
> >     $ echo "x=<$x>" "y=<$y>" "z=<$z>"
> > 
> > assignment to y and z behave identically, i.e. dq around "$x" when
> > assigning to y is not needed.
> 
> I actually had to test it to convince myself that one-shot assignments
> behaved the same way, but they do.

The mere fact that you had to test it out to convince yourself suggests to
me that my suspicion "Maybe we should quote a little bit more religiously"
was 100% spot on.

After all, almost *none* of the reviews on this mailing list involve
anything like "testing it out". It happens in the mailing program, and it
stays in the mailing program.

Ciao,
Dscho

Reply via email to