From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 29 21:54:39 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 633FC16A41F for ; Tue, 29 Nov 2005 21:54:39 +0000 (GMT) (envelope-from jayesh.freebsdlist@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.195]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7635843D67 for ; Tue, 29 Nov 2005 21:54:38 +0000 (GMT) (envelope-from jayesh.freebsdlist@gmail.com) Received: by xproxy.gmail.com with SMTP id t12so81009wxc for ; Tue, 29 Nov 2005 13:54:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=LaHwjrisQ2RiWkCN8R+/kXJ3PGSsnEJv6d5t/FcJqv+9TWdxOsyRwy4Pb3VUi/xRNx0s75Y8pCgNDp5GfRx2Df0hod6aBpUWOIyYTxtlyrhi3ZEfcAOoBTYppl1ZSPon4TDnRypz5cqRNW6C+4o8Qg53r3nA6eSWGQyMC6qVZOU= Received: by 10.70.40.14 with SMTP id n14mr2674106wxn; Tue, 29 Nov 2005 13:54:37 -0800 (PST) Received: by 10.70.7.2 with HTTP; Tue, 29 Nov 2005 13:54:37 -0800 (PST) Message-ID: Date: Wed, 30 Nov 2005 03:24:37 +0530 From: Jayesh Jayan To: Freddie Cash In-Reply-To: <200511291334.13467.fcash-ml@sd73.bc.ca> MIME-Version: 1.0 References: <200511291334.13467.fcash-ml@sd73.bc.ca> 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: freebsd-hackers@freebsd.org 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: Tue, 29 Nov 2005 21:54:39 -0000 Hi Freddie, Thank you. I have only installed bash2. I hope that may be one reason. Anyhow I have got the solution for other people in the list. Thank you once again. On 11/30/05, Freddie Cash wrote: > > On November 29, 2005 01:09 pm, Jayesh Jayan wrote: > > 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 > > /bin/sh on Linux is actually /bin/bash. > > > 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 ")") > > /bin/sh on FreeBSD is /bin/sh, the original Bourne shell. It doesn't use > that syntax > > > Please guide me on how to use arrays on freebsd too. > > Install the bash1, bash2, or bash port and use /usr/local/bin/bash to > execute the script. > > Works correctly on my 5.4 and 6.0 systems using the bash-emulation in zsh= . > > -- > Freddie Cash, LPIC-1 CCNT CCLP Helpdesk / Network Support Tech. > School District 73 (250) 377-HELP [377-4357] > fcash-ml@sd73.bc.ca > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " > -- Jayesh Jayan "The box said "Requires Windows 95, NT, or better", so I installed Linux." Visit my homepage @ http://www.jayeshjayan.com