From owner-freebsd-questions Wed Dec 4 01:35:21 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id BAA20847 for questions-outgoing; Wed, 4 Dec 1996 01:35:21 -0800 (PST) Received: from mail12.digital.com (mail12.digital.com [192.208.46.20]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id BAA20842 for ; Wed, 4 Dec 1996 01:35:18 -0800 (PST) From: garyj@frt.dec.com Received: from cssmuc.frt.dec.com by mail12.digital.com (8.7.5/UNX 1.5/1.0/WV) id EAA21925; Wed, 4 Dec 1996 04:26:58 -0500 (EST) Received: from localhost by cssmuc.frt.dec.com; (5.65v3.2/1.1.8.2/14Nov95-0232PM) id AA21832; Wed, 4 Dec 1996 10:26:25 +0100 Message-Id: <9612040926.AA21832@cssmuc.frt.dec.com> X-Mailer: exmh version 1.6.4 10/10/95 To: sln@public.jn.sd.cn Cc: questions@freebsd.org In-Reply-To: Message from sln@public.jn.sd.cn of Wed, 04 Dec 96 16:52:06 +0800. Reply-To: gjennejohn@frt.dec.com Subject: Re: shell programming Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 04 Dec 96 10:26:25 +0100 X-Mts: smtp Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk sln@public.jn.sd.cn writes: > Hi, > > I want to calculate intergers under Bourne Shell, I input the following: > > a=10 > a='expr $a+10' > 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