Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Oct 2005 19:25:40 +0100 (BST)
From:      Jan Grant <Jan.Grant@bristol.ac.uk>
To:        Will Maier <willmaier@ml1.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Help Understanding While Loop
Message-ID:  <Pine.GSO.4.62.0510151923300.17106@mail.ilrt.bris.ac.uk>
In-Reply-To: <20051014221338.GS29905@localdomain>
References:  <435027A3.8000908@mykitchentable.net> <20051014221338.GS29905@localdomain>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 14 Oct 2005, Will Maier wrote:

> > count = $(( count + 1 ))
>              ^^^ 
> 
> You're missing something here ;)

Actually, you don't need the leading "$". With it, you'll get variable 
interpolation, which'll normally do the same thing. Once the expression 
has been interpolated, it's evaluated, using the values of any variables 
named in the expression.

That is,

count=1
count=$((count + 1))
will do what Drew intended. I think his problem is elsewhere (the while 
loop is a subshell).

-- 
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44 (0)117 3317661   http://ioctl.org/jan/
"I think therefore I am." -- Ronnie Descartes



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