From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 30 23:00:28 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4F9AC16A422 for ; Wed, 30 Nov 2005 23:00:28 +0000 (GMT) (envelope-from jayesh.freebsdlist@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A1A043D69 for ; Wed, 30 Nov 2005 23:00:26 +0000 (GMT) (envelope-from jayesh.freebsdlist@gmail.com) Received: by xproxy.gmail.com with SMTP id t12so140305wxc for ; Wed, 30 Nov 2005 15:00:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=Ud9KeX/lbtL2IfpIWhNSikwRRNlTbkTVhda24jOAkWmO0K1w6cTadFXTHp0G5Y+6WVgMY/NwhgblSqc7R85A8bjKdrS9mdPtKFoU1+R8XM+vakP3DpxzHV8lGH9LE5bF8mnSo85UMjfMvHbCspSfPqCUrJqCioJTavWPPeBs3nc= Received: by 10.70.14.11 with SMTP id 11mr987458wxn; Wed, 30 Nov 2005 15:00:25 -0800 (PST) Received: by 10.70.7.2 with HTTP; Wed, 30 Nov 2005 15:00:25 -0800 (PST) Message-ID: Date: Thu, 1 Dec 2005 04:30:25 +0530 From: Jayesh Jayan To: Jayesh Jayan , freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org In-Reply-To: <20051129232439.GA26903@linuxhost> MIME-Version: 1.0 References: <20051129232439.GA26903@linuxhost> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Bash scripting -- Usage of arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2005 23:00:28 -0000 Hi Marco, Yes you are correct. It is as you have given :) Thank you. On 11/30/05, Marco Gigante wrote: > > On Wed, Nov 30, 2005 at 02:39:15AM +0530, Jayesh Jayan wrote: > > Hi, > > > > Today I was trying to script using arrays in FreeBSD 5.4 but it doesn't > > work. > > > > Below is a sample script which I used. > > > > ****************************************************** > > > > #!/bin/bash > > > > array=3D( zero one two three four); > > echo "Elements in array0: ${array[@]}" > > > > ****************************************************** > > > > It works fine on RedHat server. > > > > Below is the output. > > > > # sh array.sh > > Elements in array0: zero one two three four > > > > Below is the out put from the FreeBSD server using the same code. > > > > -bash-2.05b# sh aa.sh > > aa.sh: 3: Syntax error: word unexpected (expecting ")") > > You should use: bash array.sh > On FreeBSD sh !=3D bash > > $ ls -l `which sh` > -r-xr-xr-x 1 root wheel 763316 Sep 3 08:37 /bin/sh > $ ls -l `which bash` > -rwxr-xr-x 2 root wheel 471136 Jun 12 01:13 /usr/local/bin/bash > > Cheers > > -- > Marco Gigante > -- Jayesh Jayan "The box said "Requires Windows 95, NT, or better", so I installed Linux." Visit my homepage @ http://www.jayeshjayan.com