From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2572 invoked by alias); 31 Aug 2010 16:25:14 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15344 Received: (qmail 16949 invoked from network); 31 Aug 2010 16:25:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at seiken.de designates 62.75.149.128 as permitted sender) From: Joke de Buhr To: zsh-users@zsh.org Subject: environment variables Date: Tue, 31 Aug 2010 17:54:25 +0200 User-Agent: KMail/1.13.2 (Linux/2.6.32-24-generic; KDE/4.4.2; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2936054.N08MFhBsUT"; protocol="application/pgp-signature"; micalg=pgp-ripemd160 Content-Transfer-Encoding: 7bit Message-Id: <201008311754.27361.joke@seiken.de> --nextPart2936054.N08MFhBsUT Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I'm not sure but I think the following behavior is kind of inconsistent.=20 Setting the environment works different on functions and program. Case 1 and 2 export a variable before calling the env program. In case 2=20 copying the assignment of HELLO works as expected. Case 3 and 4 export a=20 variable before calling a function which calls the env program. In case 4=20 copying the the assignment of HELLO doesn't work because HELLO is assigned = to=20 $HELLO but assigning HELLO to $WORLD (case 3) works. Any reason why zsh behaves this way? Bash doesn't have this strange behavio= r.=20 ## 1: export to command (different variable) $ WORLD=3Dworld $ HELLO=3D$WORLD env | grep '^HELLO' HELLO=3Dworld ## 2: export to command (same variable) $ HELLO=3Dworld $ HELLO=3D$HELLO env | grep '^HELLO' HELLO=3Dworld ## 3: HELLO exported to shell function, same behavior as 1 $ call() { env | grep '^HELLO' } $ WORLD=3Dworld $ HELLO=3D$WORLD call HELLO=3Dworld ## 4: HELLO not exported to shell function, different from 2 and 3 $ call() { env | grep '^HELLO' } $ HELLO=3Dworld $ HELLO=3D$HELLO call HELLO=3D ## <-- empty --nextPart2936054.N08MFhBsUT Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQG7BAABAwAlBQJMfSWxHhhoa3A6Ly9wb29sLnNrcy1rZXlzZXJ2ZXJzLm5ldAAK CRCWUloJhwFWxgrQC/9lB5T2P2GkjJKW8Um2qUZpDIJuWalBSCsADQbqOQo3vc1G 4lO1pDKGgIMMNQHKYAuugFrtn3fygnRtiBqqTg9bltMiOcRsmMc4q+AB9k3f9S4C N2Xmee6MLnWzlypAil26jZfLwBGoBfnNqqXg1pQvlEu+0KHe+4DTbR1ZG2Cx1bc9 6B6NJSXVrvuHP0FFbcfY7y/OtBFH8ZrLCzX3fgOMOV9AF4ZYR3xsPxk6Yj8OfxKW Eav5RMfRAM5sc1OVIMTGkzhNWFhPx0sJsAogDr4Pp4soDEE+EULVft3i/bcudE6D 8ErSkL4Jr86kqtdtWccgbvPMj6AIJsQrXSgantYVRC6HrSTUMm5jpPwzDjuZdahI XmkMlRUy/XoIfk/rkzYoL1khqA2L4ddwXwC+Gtpzg1CWbrmDe16Y6KTsXF45WbNM qjQJ3JdQB+sBjHxaL0JLGp8q3VX3pheWw2ceQfKwQ6bYVJfb9KlGy6mMElwpNBsY vZZ3RWQdQyKMgQpBLoA= =4jyA -----END PGP SIGNATURE----- --nextPart2936054.N08MFhBsUT--