Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: typesetting parameters
- X-seq: zsh-users 7546
- From: Vincent Stemen <zsh@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: typesetting parameters
- Date: Mon, 14 Jun 2004 13:24:00 -0500
- In-reply-to: <Pine.LNX.4.44.0406132153360.32342-100000@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <26243486-BDAE-11D8-BDC7-000A95D2C79E@xxxxxxxxxxxxxxxx> <Pine.LNX.4.44.0406132153360.32342-100000@xxxxxxxxxxxxxxxxxx>
On Sun, Jun 13, 2004 at 09:58:57PM -0700, Bart Schaefer wrote:
> On Sun, 13 Jun 2004, lists wrote:
>
> > I'm having difficulty understanding why one would define a parameter
> > with typeset before using it.
>
> One probably wouldn't, when interactively typing commands, unless one
> wanted to use the special attributes such as padding, alignment, other
> integer bases, or floating-point precision.
>
> The primary time/place and reason to use typeset is when defining shell
> functions, to create variables that are local to the function scope. When
> you use "local" that's really an alias for typeset.
Not only that, even outside of functions, some expressions such as
variable+=$value
will not always behave as intended if the variable is not typeset. If
it is typeset as an array for example, you can depend on it appending
"$value" to the list. Otherwise it might try to add it as an integer
or append it as a string, depending on it's value.
Regards,
Vincent
--
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.
http://www.InetAddresses.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author