Subject: Re: sh arithmetic expression
To: Florian Stoehr <firstname.lastname@example.org>
From: Simon Burge <email@example.com>
Date: 12/29/2004 13:09:29
Florian Stoehr wrote:
> the follwing will run with bash, but not with /bin/sh. How to write the
> increment statement so that /bin/sh will like it? I played around with
> "let" but without success.
> while [ $i -le $1 ]
> echo "Run " $i
> i=$[$i+1] <--- bash can do that, not /bin/sh
Look at the "Arithmetic Expansion" section of sh(1).
Note that $((expr)) is part of Posix, whereas $[expr] appears
to be a bash extension. Bash also understands $((expr)).
Simon Burge <firstname.lastname@example.org>
NetBSD Support and Service: http://www.wasabisystems.com/