From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28643 invoked from network); 17 Mar 2005 21:43:19 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Mar 2005 21:43:19 -0000 Received: (qmail 83243 invoked from network); 17 Mar 2005 21:43:12 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Mar 2005 21:43:12 -0000 Received: (qmail 7188 invoked by alias); 17 Mar 2005 21:43:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21001 Received: (qmail 7175 invoked from network); 17 Mar 2005 21:43:10 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Mar 2005 21:43:10 -0000 Received: (qmail 82964 invoked from network); 17 Mar 2005 21:43:10 -0000 Received: from 203-206-238-167.dyn.iinet.net.au (HELO mail.endbracket.net) (203.206.238.167) by a.mx.sunsite.dk with SMTP; 17 Mar 2005 21:43:06 -0000 Received: from [192.168.1.7] (unknown [192.168.1.7]) by mail.endbracket.net (Postfix) with ESMTP id 055343698E; Fri, 18 Mar 2005 08:43:02 +1100 (EST) Message-ID: <4239F9E1.5070009@endbracket.net> Date: Fri, 18 Mar 2005 08:42:57 +1100 From: Michael Wardle User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bart Schaefer Cc: zsh-workers@sunsite.dk Subject: Re: problem redeclaring path variable (ksh incompatibility) References: <423994CA.4010609@endbracket.net> <1050317165007.ZM32408@candle.brasslantern.com> In-Reply-To: <1050317165007.ZM32408@candle.brasslantern.com> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 Hi Bart Thanks for your reply. > Try running your test script with ARGV0=sh in the environment and note > the difference in behavior. It didn't appear to make any difference. Are you sure this hides $path, or are you just suggesting this should be the normal way to invoke zsh any time I want it to conform closely to POSIX shell? In any case, thanks for pointing out that feature. I discovered this difference when asking zsh to read my general POSIX/Korn shell .shrc, so it is clear I should enable any sh/ksh compliance features before doing so. I'll definitely investigate it some more. > } It turns out that neither "typeset path=" nor "typeset path=value" > } create a local scalar, which doesn't meet my expectations. Strangely, > } however, "typeset path" does. > > No, it doesn't. Nowhere in your test script is $path a scalar. I had assumed it was since subsequent attempts to assign scalar (string) values to it succeed, and its global value is restored outside of the function. So this works: typeset path path= path="scalar" But this doesn't: typeset path= path="scalar" And neither does this: typeset path="" path="scalar" > zsh% func() { emulate ksh; typeset path ; path=scalar ; typeset path } > zsh% func > path=(scalar) Assuming a -m flag to the final typeset, this certainly verifies what you said. Thanks