From owner-freebsd-questions@FreeBSD.ORG Sat Oct 15 18:25:47 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 D149916A41F for ; Sat, 15 Oct 2005 18:25:47 +0000 (GMT) (envelope-from Jan.Grant@bristol.ac.uk) Received: from dirg.bris.ac.uk (dirg.bris.ac.uk [137.222.10.102]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0F51143D4C for ; Sat, 15 Oct 2005 18:25:46 +0000 (GMT) (envelope-from Jan.Grant@bristol.ac.uk) Received: from mail.ilrt.bris.ac.uk ([137.222.16.62]) by dirg.bris.ac.uk with esmtp (Exim 4.51) id 1EQqj2-0005to-84; Sat, 15 Oct 2005 19:25:45 +0100 Received: from cmjg (helo=localhost) by mail.ilrt.bris.ac.uk with local-esmtp (Exim 4.50) id 1EQqiy-00073p-JY; Sat, 15 Oct 2005 19:25:41 +0100 Date: Sat, 15 Oct 2005 19:25:40 +0100 (BST) From: Jan Grant X-X-Sender: cmjg@mail.ilrt.bris.ac.uk To: Will Maier In-Reply-To: <20051014221338.GS29905@localdomain> Message-ID: References: <435027A3.8000908@mykitchentable.net> <20051014221338.GS29905@localdomain> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Jan Grant X-Spam-Score: -1.4 X-Spam-Level: - Cc: freebsd-questions@freebsd.org Subject: Re: Help Understanding While Loop 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: Sat, 15 Oct 2005 18:25:47 -0000 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