From owner-freebsd-questions Sun Jul 28 13: 0:45 2002 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 9117437B401 for ; Sun, 28 Jul 2002 13:00:41 -0700 (PDT) Received: from mail.halplant.com (ip68-100-145-31.nv.nv.cox.net [68.100.145.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D3B043E3B for ; Sun, 28 Jul 2002 13:00:35 -0700 (PDT) (envelope-from A.J.Caines@halplant.com) Received: by mail.halplant.com (Postfix, from userid 1001) id EA3BE1AB; Sun, 28 Jul 2002 16:00:32 -0400 (EDT) Date: Sun, 28 Jul 2002 16:00:32 -0400 From: Andrew J Caines To: freebsd-questions@FreeBSD.ORG Subject: Re: 'let' syntax in /bin/sh Message-ID: <20020728200032.GM85183@hal9000.halplant.com> Reply-To: Andrew J Caines Mail-Followup-To: freebsd-questions@FreeBSD.ORG References: <20020726221426.21bacb51.ugly@inhuman.org> <20020728194431.GD73369@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020728194431.GD73369@dan.emsphone.com> Organization: H.A.L. Plant X-PGP-Fingerprint: C59A 2F74 1139 9432 B457 0B61 DDF2 AA61 67C3 18A1 X-Powered-by: FreeBSD 4.6-STABLE X-URL: http://halplant.com:88/ Importance: Normal User-Agent: Mutt/1.5.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG To add a note to Dan Nelson's good advice... > just do "x=0". If you want to assign the result of a math expression > to a variable, do "y=$(($x+1))". "let ..." is equivalent to "$(( ... ))" The shell arithmetic - (( ... )) - is not a common feature of the many and various Bourne shell implementations. If you're looking for a lowest common denominator for shell arithmetic, see expr(1). Shell arithmetic is implemented quite consistently in ksh and bash (and probably zsh). -Andrew- -- _______________________________________________________________________ | -Andrew J. Caines- Unix Systems Engineer A.J.Caines@halplant.com | | "They that can give up essential liberty to obtain a little temporary | | safety deserve neither liberty nor safety" - Benjamin Franklin, 1759 | To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message