From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes From: "Bart Schaefer" Message-Id: <990205231756.ZM27407@candle.brasslantern.com> Date: Fri, 5 Feb 1999 23:17:56 -0800 In-Reply-To: <990205202722.ZM26495@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Re: Globbing in a function (was Re: globbing for links in pathnames)" (Feb 5, 8:27pm) References: <199902042236.PAA11357@ipecac.Central.Sun.COM> <19990204182743.A19812@astaroth.nit.gwu.edu> <990204165600.ZM19580@candle.brasslantern.com> <19990204232219.B20361@astaroth.nit.gwu.edu> <990204210755.ZM20448@candle.brasslantern.com> <19990205184853.A24198@astaroth.nit.gwu.edu> <990205202722.ZM26495@candle.brasslantern.com> X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@sunsite.auc.dk Subject: How does one describe $argv ? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailing-List: 5296 On Feb 5, 8:27pm, I wrote: } } binlink () { } argv=($^~==*(*)) } ln -s "$PWD/$^@" /usr/local/bin } } On Feb 4, 10:23pm, I wrote: } } @@ -40,7 +40,8 @@ } (Parameters are dynamically scoped.) The tt(typeset) builtin, and its } alternative forms tt(declare), tt(integer), tt(local) and tt(readonly) } (but not tt(export)), can be used to declare a parameter as being local } -to the innermost scope. } +to the innermost scope. Note that em(special) parameters cannot be made } +local. What's wrong with this picture? In some sense, $argv is always local: ---------- zsh% set a b c zsh% f() { echo $argv } zsh% f zsh% f x y z x y z zsh% echo $argv a b c ---------- In some other sense, $argv is always global: ---------- zsh% set a b c zsh% f() { unset argv } zsh% f zsh% echo $argv zsh% echo $* a b c ---------- I find that last bit especially puzzling; $argv is not set but $* is? And once you get into this state, "set" gets funny on you: ---------- zsh% set d e f zsh% echo $* d e f zsh% echo $argv zsh% argv=($*) zsh% echo $argv d e f zsh% set a b c zsh% echo $argv a b c ---------- Somehow, I don't think the "Parameters Set By The Shell" entry for `argv' even begins to be adequate to its task: `argv' Same as `*'. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com