From owner-freebsd-questions@FreeBSD.ORG Wed Jun 29 08:35:38 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 02DE316A41C for ; Wed, 29 Jun 2005 08:35:38 +0000 (GMT) (envelope-from bkoenig@cs.tu-berlin.de) Received: from mail.efacilitas.de (efacilitas.de [213.133.110.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id B41AA43D1F for ; Wed, 29 Jun 2005 08:35:37 +0000 (GMT) (envelope-from bkoenig@cs.tu-berlin.de) Received: from eurystheus.local (port-212-202-37-29.dynamic.qsc.de [212.202.37.29]) by mail.efacilitas.de (Postfix) with ESMTP id 97C231239DE; Wed, 29 Jun 2005 10:33:54 +0200 (CEST) Received: from localhost (eurystheus.local [192.168.1.67]) by eurystheus.local (Postfix) with ESMTP id B143912B0A4; Wed, 29 Jun 2005 10:34:07 +0200 (CEST) Received: from eurystheus.local ([192.168.1.67]) by localhost (eurystheus.locaL [192.168.1.67]) (amavisd-new, port 10024) with ESMTP id 22621-03; Wed, 29 Jun 2005 10:34:03 +0200 (CEST) Received: from [192.168.1.67] (eurystheus.local [192.168.1.67]) by eurystheus.local (Postfix) with ESMTP id 430BB12B09E; Wed, 29 Jun 2005 10:34:03 +0200 (CEST) Message-ID: <42C25CFA.2040800@cs.tu-berlin.de> Date: Wed, 29 Jun 2005 10:34:02 +0200 From: =?ISO-8859-1?Q?Bj=F6rn_K=F6nig?= User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.8) Gecko/20050517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mike Jeays References: <1120015025.659.12.camel@chaucer> In-Reply-To: <1120015025.659.12.camel@chaucer> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: amavisd-new at example.com Cc: fbsd_user@a1poweruser.com, "freebsd-questions@FreeBSD. ORG" Subject: Re: Shell script help X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 08:35:38 -0000 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