Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Dec 2005 04:30:25 +0530
From:      Jayesh Jayan <jayesh.freebsdlist@gmail.com>
To:        Jayesh Jayan <jayesh.freebsdlist@gmail.com>, freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: Bash scripting -- Usage of arrays
Message-ID:  <e8ecf3c00511301500i4c2f5777j2990a20c775d2eac@mail.gmail.com>
In-Reply-To: <20051129232439.GA26903@linuxhost>
References:  <e8ecf3c00511291309yb9caeb9uebdf92c4ad7af4f8@mail.gmail.com> <20051129232439.GA26903@linuxhost>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Marco,

Yes you are correct. It is as you have given :)

Thank you.


On 11/30/05, Marco Gigante <marcogi.lists@email.it> 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



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