From owner-freebsd-questions Thu Aug 22 23:34:24 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A10337B400 for ; Thu, 22 Aug 2002 23:34:22 -0700 (PDT) Received: from topaz.mdcc.cx (topaz.mdcc.cx [212.204.230.141]) by mx1.FreeBSD.org (Postfix) with ESMTP id D270743E91 for ; Thu, 22 Aug 2002 23:34:21 -0700 (PDT) (envelope-from edwin@mavetju.org) Received: from k7.mavetju (topaz.mdcc.cx [212.204.230.141]) by topaz.mdcc.cx (Postfix) with ESMTP id EB8412B916; Fri, 23 Aug 2002 08:34:09 +0200 (CEST) Received: by k7.mavetju (Postfix, from userid 1001) id 9667D6A7124; Fri, 23 Aug 2002 16:33:08 +1000 (EST) Date: Fri, 23 Aug 2002 16:33:08 +1000 From: Edwin Groothuis To: "Christopher J. Umina" Cc: freebsd-questions@freebsd.org Subject: Re: expr replacement Message-ID: <20020823063308.GL785@k7.mavetju> Mail-Followup-To: Edwin Groothuis , "Christopher J. Umina" , freebsd-questions@freebsd.org References: <20020823021838.V67143-100000@216-164-225-145.c3-0.wth-ubr2.sbo-wth.ma.cable.rcn.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020823021838.V67143-100000@216-164-225-145.c3-0.wth-ubr2.sbo-wth.ma.cable.rcn.com> User-Agent: Mutt/1.4i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Aug 23, 2002 at 02:21:14AM -0400, Christopher J. Umina wrote: > I'm writing a simple shell script that finds percentages for me. > The problem here is that when I do the division with expr I always get a > result of 0 since it's below 1. Is there a replacement for this or am I > just doing it wrong? Take a look.. This is my command. > > percentage=`expr $dirttl / $totalsongs` > > where $totalsongs = aroudn 1000 and dirttl = anywhere from 8 to 565. Use a bulldozer: percentage=`perl -e "print $dirttl / $totalsongs"` Edwin -- Edwin Groothuis | Personal website: http://www.MavEtJu.org edwin@mavetju.org | Weblog: http://www.mavetju.org/weblog/weblog.php bash$ :(){ :|:&};: | Interested in MUDs? http://www.FatalDimensions.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message