Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jan 2000 16:05:01 +0600 (NOVT)
From:      "Alexey N. Dokuchaev" <danfe@ssc.nsu.ru>
To:        Sheldon Hearn <sheldonh@uunet.co.za>
Cc:        dl@tyfon.net, "[FreeBSD-Questions-List] (E-post)" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: mathematics in sh 
Message-ID:  <Pine.LNX.4.10.10001111602250.11760-100000@inet.ssc.nsu.ru>
In-Reply-To: <99240.947584237@axl.noc.iafrica.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 11 Jan 2000, Sheldon Hearn wrote:

> 
> 
> On Tue, 11 Jan 2000 09:49:28 +0100, Dan Larsson wrote:
> 
> > Is it possible to do mathematical ( simple calculations such as
> > ($a + $b)/$c) calculations in sh?
> 
> > Or is perl better to use in this case?
> 
> Perl's better if you need floating point values.  But for simple integer
> arithmetic, /bin/sh works fine.
> 
> See the Arithmetic Expansion section of the sh(1) manual page.
> 
> Ciao,
> Sheldon.
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 

I always use echo $((1234*25)) when trying to convert rubbles to bucks ;-)

it also understands |, ^, & (binary), 0x... and much more.


 ,--------------------------------------,     ____            ___  _______
 | Alexey N. Dokuchaev, more commonly   |    / __/______ ___ / _ )/ __/ _ \
 | known as DAN Fe                      |   / _// __/ -_) -_) _  |\ \/ // /
 |                                      |  /_/ /_/  __/__/ /____/___/____/
 | Novosibirsk State University         `-------- The Power to Serve --------,
 | Scientific Study Center Computer Lab                                      |
 |                                                                           |
 | email: danfe@inet.ssc.nsu.ru     homepage: http://inet.ssc.nsu.ru/~danfe/ |
 | ICQ UIN: 38934845                                                         |
 `---------------------------------------------------------------------------'

A good conspiracy is unprovable.  I mean, if you can prove it, it means they
screwed up somewhere along the line.

					Jerry Fletcher from Conspiracy Theory



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?Pine.LNX.4.10.10001111602250.11760-100000>