[gnu.bash.bug] "export foo=bar" bug

jjd@BBN.COM (James J Dempsey) (07/20/89)

I always thought that the csh syntax of setting environment variables:

setenv foo bar

was a lot cleaner than sh syntax:

foo=bar
export foo

so I was overjoyed when someone on this list pointed out that in bash
you could say:

export foo=bar

which is just as clean as the csh syntax.  However, I seem to have
found a bug:

$ xxx='foo\bar'
$ echo $xxx
foo\bar
$
$ yyy=$xxx
$ echo $yyy
foo\bar
$ export zzz=$xxx
$ echo $zzz
foobar
$

The above script shows that if you use the "export foo=bar" notation
that backslashes in the right side are deleted.  This doesn't happen
if you use "foo=bar;export foo" notation.

		--Jim--