Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Nov 2005 03:24:37 +0530
From:      Jayesh Jayan <jayesh.freebsdlist@gmail.com>
To:        Freddie Cash <fcash-ml@sd73.bc.ca>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Bash scripting -- Usage of arrays
Message-ID:  <e8ecf3c00511291354w4867261dw711aef469f5e6cf6@mail.gmail.com>
In-Reply-To: <200511291334.13467.fcash-ml@sd73.bc.ca>
References:  <e8ecf3c00511291309yb9caeb9uebdf92c4ad7af4f8@mail.gmail.com> <200511291334.13467.fcash-ml@sd73.bc.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <fcash-ml@sd73.bc.ca> 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



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