Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Fw: "VAR=foo export VAR" no longer works in zsh emulation



Begin forwarded message:

Date: Tue, 24 Jan 2017 13:24:28 +0000
From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
Subject: "VAR=foo export VAR" no longer works in zsh emulation


[repost]

looks like my email didn't make it to the zsh-workers ML
yesterday (sent Mon, 23 Jan 2017 15:30:23 +0000), so I'm
reposting it to you. Sorry for the dup if it ever makes its way
to the list.


VAR=foo export VAR

used to work in zsh the same way as in other Bourne-like shells.
That syntax the Bourne equivalent of Korn's:

export VAR=foo

(without the ambiguity of whether VAR=foo should be treated as
an assignment or a command argument).

It no longer works in zsh 5.3.1 ($VAR not modified). As in the
latest Debian unstable package for zsh.

$ VAR=123
$ VAR=abc export VAR
$ echo $VAR
123
$ emulate sh
$ VAR=abc export VAR
$ echo "$VAR"
abc

I found that out when some Bourne-compatible code sourced from
my .zshrc stopped working.

Is the change intentional?

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author