Date: Wed, 29 Jun 2005 10:34:02 +0200 From: =?ISO-8859-1?Q?Bj=F6rn_K=F6nig?= <bkoenig@cs.tu-berlin.de> To: Mike Jeays <Mike.Jeays@rogers.com> Cc: fbsd_user@a1poweruser.com, "freebsd-questions@FreeBSD. ORG" <freebsd-questions@freebsd.org> Subject: Re: Shell script help Message-ID: <42C25CFA.2040800@cs.tu-berlin.de> In-Reply-To: <1120015025.659.12.camel@chaucer> References: <MIEPLLIBMLEEABPDBIEGCEOCHHAA.fbsd_user@a1poweruser.com> <1120015025.659.12.camel@chaucer>
next in thread | previous in thread | raw e-mail | index | archive | help
Mike Jeays wrote: > "man expr" to give the short answer to your first question: > > As an example, x=`expr $x + 1` > > 536 ~ $ x=4 > 537 ~ $ x=`expr $x + 1` > 538 ~ $ echo $ > > Note the back-quotes to execute a command and return the result, and the > need for spaces between each token in the expr command. sh(1) is able to evaluate arithmetic expressions too, e.g. x=$(($x+1)) Björn
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42C25CFA.2040800>