From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17403 invoked by alias); 14 Dec 2009 16:06:41 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27515 Received: (qmail 2436 invoked from network); 14 Dec 2009 16:06:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <091214080634.ZM8254@torch.brasslantern.com> Date: Mon, 14 Dec 2009 08:06:34 -0800 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: More nits on var=value command MIME-version: 1.0 Content-type: text/plain; charset=us-ascii The "var=value command" syntax is supposed to set var to value in the environment of command. schaefer<529> outer=INNER printenv outer INNER "typeset +x" removes a variable from the environment: schaefer<530> outer=INNER eval 'printenv outer; typeset +x outer; printenv outer' INNER But assignment to "outer" in this case automatically exports it again: schaefer<531> outer=INNER eval 'printenv outer; typeset +x outer=$outer; printenv outer' INNER INNER schaefer<532> outer=INNER eval 'printenv outer; typeset +x outer; outer=$outer; printenv outer' INNER INNER schaefer<533> outer=INNER eval 'printenv outer; typeset +x outer; outer=$outer; printenv outer; typeset +x outer; printenv outer' INNER INNER Finally, the variable is unset at the end whether or not it's still in the environment: schaefer<534> echo X $outer X X X Bash differs from zsh on the "automatically exported" part but not on the unset-it-anyway part: [schaefer@torch ~]$ outer=INNER eval 'printenv outer; typeset +x outer; outer=$outer; printenv outer; typeset +x outer; printenv outer' INNER [schaefer@torch ~]$ echo X $outer X X X