From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6818 invoked from network); 5 Jan 2006 04:44:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Jan 2006 04:44:18 -0000 Received: (qmail 45562 invoked from network); 5 Jan 2006 04:44:10 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Jan 2006 04:44:10 -0000 Received: (qmail 24098 invoked by alias); 5 Jan 2006 04:44:02 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9807 Received: (qmail 24088 invoked from network); 5 Jan 2006 04:44:01 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Jan 2006 04:44:01 -0000 Received: (qmail 44538 invoked from network); 5 Jan 2006 04:44:01 -0000 Received: from s1tank.virtdom.com (216.240.101.50) by a.mx.sunsite.dk with SMTP; 5 Jan 2006 04:44:00 -0000 Received: (qmail 70911 invoked by uid 89); 5 Jan 2006 05:18:21 -0000 Received: from ool-4355e580.dyn.optonline.net (HELO venti) (brian@aljex.com@67.85.229.128) by s1tank.virtdom.com with SMTP; 5 Jan 2006 05:18:21 -0000 Message-ID: <00af01c611b2$a287fdb0$951fa8c0@venti> From: "Brian K. White" To: References: <024d01c60dd7$576ed990$931fa8c0@venti> <20051231072500.GJ39217@dan.emsphone.com> <00df01c60e4a$fb8d2d60$931fa8c0@venti> <488030720601041505g7a9aee72nc8ebcf1bde13b3a4@mail.gmail.com> Subject: Re: math, percentage Date: Wed, 4 Jan 2006 23:43:54 -0500 Organization: Aljex Software MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 ----- Original Message ----- From: "John Reese" To: "Brian K. White" Sent: Wednesday, January 04, 2006 6:05 PM Subject: Re: math, percentage > Nice. > Never knew you could do the assignment inside the braces like that, > but even so I should have thought to at least try tp=$((t*100/T)) since I > use n=$((n+1)) a hundred times a day. > > thanks > Brian K. White -- brian@aljex.com -- http://www.aljex.com/bkw/ You could do ((n++)) instead and save three hundred characters a day. ---- Ah, neat. :) It should be noted though: Up to to this point the examples also work in ksh88 ,the version of ksh still shipping stock with many commercial unii as /bin/ksh. ((n++)) does not work in ksh88. It does work in ksh93, bash, pdksh, and of course zsh. Most of my fancier scripts need to explicitly call a particular shell anways because of special features, so this is useful. Brian K. White -- brian@aljex.com -- http://www.aljex.com/bkw/ +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk! ----- The existence and availability of ksh93 for most platforms, even though it even ships stock with a few very recent ones (but still not as /bin/ksh), must not be considered as the simple answer for anything that doesn't work in ksh88 though because it's a bit buggy on some systems and cannot be used as the drop in replacement for the stock sh or ksh or as roots or even a users login shell. Ask me how I know. :) It seems ok at first but after a few days in production with a couple hundred users you realize you are having a lot of scattered problems you didn't used to have, and putting the old binary back ends the trend. It's useful enough though to install it somewhere and call it explicitly on the bang line. My biggest item about ksh93 lately is that it has a built-in sleep that takes floating point values. I have things that really do want a "sleep .1", and anything that wants that, by definition also really wants it built-in, not to fork a child and load an executable every time. No other shell anywhere has that that I've found. (hint!) Perl has nap() and probably other popular non bourne scripting languages have some form of usleep or sleep .xx but heck, so what? So does C. Also there is: VARS="look at all these assignments woohoo read is cool how many lines of code would this be without it I ask you montoyo inigra" grep "^${LOGNAME}:" /path/to/userdefs | IFS=: read junk $VARS export $VARS echo $woohoo The bugginess of ksh93 on the system above is at least partly due to the at&t build system for ksh that is such a pain in the ___ that hardly anyone even attempts to build it, and fewer succeed. For SCO Open Server 5.x.x and lower, there is exactly one binary out there, made by one guy a few years ago, and it's a little buggy, and he knew it all along, and he's not attempting to play with it again. I tried but ran into problems that I couldn't debug because the convoluted build system hid and buried the real problem too well and I actually have a job that doesn't allow me a couple of solid weeks just to build a new shell. :) So it's possible that ksh93 itself is fine and merely it's difficult to do a thorough job of porting it. Either way, it still means you can't count on it.