From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21929 invoked from network); 28 May 2000 09:10:36 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 May 2000 09:10:36 -0000 Received: (qmail 17994 invoked by alias); 28 May 2000 09:10:25 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11609 Received: (qmail 17987 invoked from network); 28 May 2000 09:10:24 -0000 Date: Sun, 28 May 2000 11:10:22 +0200 From: Bernd Eggink To: zsh-workers@sunsite.auc.dk Subject: Re: Positional parameters and sourced files Message-ID: <20000528111017.B392@eggink3.rrz.uni-hamburg.de> Mail-Followup-To: zsh-workers@sunsite.auc.dk References: <1000528003111.ZM22806@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <1000528003111.ZM22806@candle.brasslantern.com>; from schaefer@candle.brasslantern.com on Sun, May 28, 2000 at 12:31:10AM +0000 On Sun, May 28, 2000 at 12:31:10AM +0000, Bart Schaefer wrote: > Put these commands in /tmp/test.zsh: > > echo $# $* > set a b c d e > > Now: > > zsh% source /tmp/test.zsh ; echo $# > 0 > 5 > zsh% source /tmp/test.zsh arg ; echo $# > 1 arg > 0 > > > So "set ..." in a sourced script changes the global positional parameters > when the script is called with no arguments, but if it was called with any > arguments then it changes only the locals. This seems a bit odd. > > Bash, on the other hand, always changes the global positional parameters, > and further it throws away the local ones when the global ones are set. I > don't have ksh handy to try. ksh behaves the same way as zsh. IMHO the bash behavior is the most reasonable one. Regards, Bernd -- Bernd Eggink Regionales Rechenzentrum der Uni Hamburg eggink@uni-hamburg.de http://www.rrz.uni-hamburg.de/eggink/BEggink.html