Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2002 03:37:54 -0400
From:      Klaus Steden <klaus@compt.com>
To:        "Christopher J. Umina" <uminac@216-164-225-145.c3-0.wth-ubr2.sbo-wth.ma.cable.rcn.com>
Cc:        Edwin Groothuis <edwin@mavetju.org>, freebsd-questions@FreeBSD.ORG
Subject:   Re: expr replacement
Message-ID:  <20020823033754.K66371@cthulu.compt.com>
In-Reply-To: <20020823025441.O44828-100000@216-164-225-145.c3-0.wth-ubr2.sbo-wth.ma.cable.rcn.com>; from uminac@216-164-225-145.c3-0.wth-ubr2.sbo-wth.ma.cable.rcn.com on Fri, Aug 23, 2002 at 02:55:57AM -0400
References:  <20020823063308.GL785@k7.mavetju> <20020823025441.O44828-100000@216-164-225-145.c3-0.wth-ubr2.sbo-wth.ma.cable.rcn.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> When I do that it doesn't get the values for some reason and it gives me a
> divide by zero error...  I think it's because Perl's looking for it's own
> variables, not the ones set in the shell script.  But I can't think of a
> way to put them in there.  The problem with expr is that I can't get to 2
> decimal places.  I really need that.
> 
If you don't like awk, or perl still doesn't work, you can also try 'bc'.

i.e. i=13412; j=2; k=`echo "$i / $j" |bc`; echo $k
6706

hth,
Klaus

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020823033754.K66371>