Re: [PATCH v2] Replace instances of export VAR=VAL with VAR=VAL; export VAR
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Nov 29, 2007, 07:39 UTC
- Message-ID
- <474E6CC8.8000301@viscovery.net>
- In-Reply-To
- <85sl2q6kyu.fsf@lola.goethe.zz>
David Kastrup schrieb:
Show 16 quoted lines
> Junio C Hamano <gitster@pobox.com> writes: >> I thought somebody already mention that ash mishandles "export VAR=VAL" >> but otherwise Ok. > > dak@lola:~$ ash > $ export JUNK=woozle > $ sh -c 'echo $JUNK' > woozle > $ exit > dak@lola:~$ dash > $ export JUNK=woozle > $ sh -c 'echo $JUNK' > woozle > $ exit > > What problem are we talking about exactly, and with what shell?
$ export foo="bar baz" $ bash bash$ export JUNK=$foo bash$ sh -c 'echo "$JUNK"' bar baz bash$ exit exit $ ash ash$ export JUNK=$foo ash$ sh -c 'echo "$JUNK"' bar ash$ exit
The problem is $foo not being quoted on the RHS of the assignment of the export command: bash doesn't word-split, but ash does. Hence, *if* export VAR=VAL is used, always quote VAL.
-- Hannes