Re: Bash scripting -- Usage of arrays

From: Marco Gigante (marcogi.lists_at_email.it)
Date: 11/30/05

  • Next message: Craig Boston: "Weird PCI interrupt delivery problem"
    Date: Wed, 30 Nov 2005 00:24:39 +0100
    To: Jayesh Jayan <jayesh.freebsdlist@gmail.com>
    
    

    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=( 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 != 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
    _______________________________________________
    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"
    

  • Next message: Craig Boston: "Weird PCI interrupt delivery problem"

    Relevant Pages

    • Re: Bash scripting -- Usage of arrays
      ... >> Below is a sample script which I used. ... >> It works fine on RedHat server. ... >> Below is the out put from the FreeBSD server using the same code. ... > You should use: bash array.sh ...
      (freebsd-hackers)
    • Re: Bash scripting -- Usage of arrays
      ... >> Below is a sample script which I used. ... >> It works fine on RedHat server. ... >> Below is the out put from the FreeBSD server using the same code. ... > You should use: bash array.sh ...
      (freebsd-questions)
    • Bash scripting -- Usage of arrays
      ... Below is a sample script which I used. ... zero one two three four ... Below is the out put from the FreeBSD server using the same code. ... Please guide me on how to use arrays on freebsd too. ...
      (freebsd-hackers)
    • Bash scripting -- Usage of arrays
      ... Below is a sample script which I used. ... zero one two three four ... Below is the out put from the FreeBSD server using the same code. ... Please guide me on how to use arrays on freebsd too. ...
      (freebsd-questions)
    • Re: Bash scripting -- Usage of arrays
      ... > Below is a sample script which I used. ... > It works fine on RedHat server. ... > Below is the out put from the FreeBSD server using the same code. ... You should use: bash array.sh ...
      (freebsd-questions)