From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23510 invoked from network); 24 Nov 1999 17:44:21 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 24 Nov 1999 17:44:21 -0000 Received: (qmail 23518 invoked by alias); 24 Nov 1999 17:44:15 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8773 Received: (qmail 23510 invoked from network); 24 Nov 1999 17:44:13 -0000 From: "Bart Schaefer" Message-Id: <991124174400.ZM1627@candle.brasslantern.com> Date: Wed, 24 Nov 1999 17:44:00 +0000 In-Reply-To: <199911241150.MAA15227@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: "getopts" bugs and bad interactions with "shift"" (Nov 24, 12:50pm) References: <199911241150.MAA15227@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (5.0.0 30July97) To: Sven Wischnowsky , zsh-workers@sunsite.auc.dk Subject: Re: "getopts" bugs and bad interactions with "shift" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 24, 12:50pm, Sven Wischnowsky wrote: } Subject: Re: "getopts" bugs and bad interactions with "shift" } } Bart Schaefer wrote: } } > ... } > shift $OPTIND # $((OPTIND-1)) if 3.0.7 or before } > ... } > return $ret } } I think, when *you* do this kind of stuff, you have a good reason, so: } why the `$'s (and even `$((...))')? Compatibility with other shells? Compatibility with my brain, is more like it. When re-reading a script, I like being able to tell, without having to think about the context, whether a string is just a string, or is the name of a parameter. I've never particularly liked the feature that you can omit the $ in math context, though it almost makes sense in the case of $[foo] and $((foo)) to not need $[$foo]. ("Almost" because of this: zagzig[21] setopt nounset zagzig[22] echo $foo zsh: foo: parameter not set zagzig[23] echo $[foo] 0 I hate not being able to use nounset to detect typographical errors in parameter names.) To a lesser extent, it's defensive programming in the sense that if I don't get used to leaving off the $ in zsh scripts then I won't forget to use it in plain sh scripts. Finally, it means I don't have to remember where zsh uses math context and where it doesn't; and the less I have to remember, the better. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com