Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Dec 96 10:26:25 +0100
From:      garyj@frt.dec.com
To:        sln@public.jn.sd.cn
Cc:        questions@freebsd.org
Subject:   Re: shell programming 
Message-ID:  <9612040926.AA21832@cssmuc.frt.dec.com>
In-Reply-To: Message from sln@public.jn.sd.cn  of Wed, 04 Dec 96 16:52:06  %2B0800.

next in thread | raw e-mail | index | archive | help

sln@public.jn.sd.cn writes:
> Hi,
> 
> I want to calculate intergers under Bourne Shell, I input the following:
> 
> a=10 <enter>
> a='expr $a+10' <enter>
> 

should read a=`expr $a + 10`

the backquotes and spaces are important. You could have found this out
by reading the man page.

> Further more, I want to know a general way to do some calculation using 
> variables under unix shell.
> 

depends on the shell, e.g. bash has built-ins for this sort of thing.
expr is probably the best way to do this since it should work for
all shells.

---
Gary Jennejohn				(work) gjennejohn@frt.dec.com
					(home) Gary.Jennejohn@munich.netsurf.de
					(play) gj@freebsd.org





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