From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28275 invoked from network); 14 Jun 2004 18:32:53 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 14 Jun 2004 18:32:53 -0000 Received: (qmail 1615 invoked from network); 14 Jun 2004 18:27:18 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Jun 2004 18:27:18 -0000 Received: (qmail 18409 invoked by alias); 14 Jun 2004 18:26:55 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7546 Received: (qmail 18400 invoked from network); 14 Jun 2004 18:26:55 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 14 Jun 2004 18:26:52 -0000 Received: (qmail 28369 invoked from network); 14 Jun 2004 18:24:18 -0000 Received: from lakermmtao12.cox.net (68.230.240.27) by a.mx.sunsite.dk with SMTP; 14 Jun 2004 18:24:17 -0000 Received: from quark.hightek.org ([68.12.75.33]) by lakermmtao12.cox.net (InterMail vM.6.01.03.02 201-2131-111-104-20040324) with ESMTP id <20040614182348.KLZB9233.lakermmtao12.cox.net@quark.hightek.org> for ; Mon, 14 Jun 2004 14:23:48 -0400 Received: by quark.hightek.org (Postfix, from userid 501) id 45AA612422; Mon, 14 Jun 2004 13:24:00 -0500 (CDT) Date: Mon, 14 Jun 2004 13:24:00 -0500 From: Vincent Stemen To: zsh-users@sunsite.dk Subject: Re: typesetting parameters Message-ID: <20040614182400.GA6105@quark.hightek.org> References: <26243486-BDAE-11D8-BDC7-000A95D2C79E@kalama.no-ip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 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