Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jul 2002 16:00:32 -0400
From:      Andrew J Caines <A.J.Caines@halplant.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: 'let' syntax in /bin/sh
Message-ID:  <20020728200032.GM85183@hal9000.halplant.com>
In-Reply-To: <20020728194431.GD73369@dan.emsphone.com>
References:  <20020726221426.21bacb51.ugly@inhuman.org> <20020728194431.GD73369@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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