From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16093 invoked from network); 31 Dec 2005 20:44:57 -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; 31 Dec 2005 20:44:57 -0000 Received: (qmail 86189 invoked from network); 31 Dec 2005 20:44:44 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 31 Dec 2005 20:44:43 -0000 Received: (qmail 26616 invoked by alias); 31 Dec 2005 20:44:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9806 Received: (qmail 26606 invoked from network); 31 Dec 2005 20:44:36 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 31 Dec 2005 20:44:36 -0000 Received: (qmail 85125 invoked from network); 31 Dec 2005 20:44:36 -0000 Received: from s1tank.virtdom.com (216.240.101.50) by a.mx.sunsite.dk with SMTP; 31 Dec 2005 20:44:35 -0000 Received: (qmail 81836 invoked by uid 89); 31 Dec 2005 21:18:25 -0000 Received: from ool-4355e580.dyn.optonline.net (HELO venti) (brian@aljex.com@67.85.229.128) by s1tank.virtdom.com with SMTP; 31 Dec 2005 21:18:25 -0000 Message-ID: <00df01c60e4a$fb8d2d60$931fa8c0@venti> From: "Brian K. White" To: References: <024d01c60dd7$576ed990$931fa8c0@venti> <20051231072500.GJ39217@dan.emsphone.com> Subject: Re: math, percentage Date: Sat, 31 Dec 2005 15:44:23 -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: "Dan Nelson" To: "Brian K. White" Cc: Sent: Saturday, December 31, 2005 2:25 AM Subject: Re: math, percentage > In the last episode (Dec 31), Brian K. White said: >> is there a way to do this with built in math instead of running bc ? >> >> tp=`echo "scale=0;(${t}*100)/$T" |bc` >> >> T = some dynamic total number like `ls |wc -l` >> t = counter that starts at 1 and incriments as a loop walks through T >> tp = percent of total job completed so far > > (( tp=t*100/T )) 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/ +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk!