From owner-freebsd-questions@FreeBSD.ORG Fri Aug 12 03:04:39 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 1C5D716A420 for ; Fri, 12 Aug 2005 03:04:39 +0000 (GMT) (envelope-from dpk@dpk.net) Received: from shared10.hosting.flyingcroc.net (shared10.hosting.flyingcroc.net [207.246.149.144]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0DA1243D49 for ; Fri, 12 Aug 2005 03:04:37 +0000 (GMT) (envelope-from dpk@dpk.net) Received: from shared10.hosting.flyingcroc.net (localhost [127.0.0.1]) by shared10.hosting.flyingcroc.net (8.12.9p2/8.12.10) with ESMTP id j7C34TrR013857; Thu, 11 Aug 2005 20:04:29 -0700 (PDT) Received: from localhost (dpk@localhost) by shared10.hosting.flyingcroc.net (8.12.9p2/8.12.10/Submit) with ESMTP id j7C34T4F013854; Thu, 11 Aug 2005 20:04:29 -0700 (PDT) X-Authentication-Warning: shared10.hosting.flyingcroc.net: dpk owned process doing -bs Date: Thu, 11 Aug 2005 20:04:29 -0700 (PDT) From: dpk X-X-Sender: dpk@shared10.hosting.flyingcroc.net To: Xu Qiang In-Reply-To: <20050812025925.942541D9A4@imss.sgp.fujixerox.com> Message-ID: <20050811200106.S5643@shared10.hosting.flyingcroc.net> References: <20050812025925.942541D9A4@imss.sgp.fujixerox.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Giorgos Keramidas , freebsd-questions@freebsd.org Subject: RE: Help on bash script? 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: Fri, 12 Aug 2005 03:04:39 -0000 On Fri, 12 Aug 2005, Xu Qiang wrote: > This is my test script: > > --------------------- > #!/bin/bash > > var=0 > var=$[3] > > vari=0 > ++vari > > echo $var > echo $vari > --------------------- > > The result is: > ./test.sh: ++vari: command not found > 3 > 0 > > So the manual of bash is incorrect? > > Regards, > Xu Qiang It will work with either 'let' or within an 'arithmetic expansion': $[++var] let ++var By the way, there is another syntax, from the man page, that seems to operate identically: $((++var)) and $((var+1))