Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
How does one describe $argv ?
- X-seq: zsh-workers 5296
 
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxxxxxxxxx
 
- Subject: How does one describe $argv ?
 
- Date: Fri, 5 Feb 1999 23:17:56 -0800
 
- In-reply-to: <990205202722.ZM26495@xxxxxxxxxxxxxxxxxxxxxxx>
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
- References: <199902042236.PAA11357@xxxxxxxxxxxxxxxxxxxxxx> 	<19990204182743.A19812@xxxxxxxxxxxxxxxxxxxx> 	<990204165600.ZM19580@xxxxxxxxxxxxxxxxxxxxxxx> 	<19990204232219.B20361@xxxxxxxxxxxxxxxxxxxx> 	<990204210755.ZM20448@xxxxxxxxxxxxxxxxxxxxxxx> 	<19990205184853.A24198@xxxxxxxxxxxxxxxxxxxx> 	<990205202722.ZM26495@xxxxxxxxxxxxxxxxxxxxxxx>
 
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' <S> <Z>
     Same as `*'.
-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author