-   Programming (
-   -   shell script array problem (

rche3252 10-08-2003 11:18 PM

shell script array problem
I have some problem using the array, when i type "array1= (one two three)" in the shell it always gives me error messege says"error sytanx unexpected token array1=("

SaTaN 10-08-2003 11:43 PM

This is how arrays are used....


array=( zero one two three four five )
echo ${array[0]}      #  zero
echo ${array:0}        #  zero
                      #  Parameter expansion of first element.
echo ${array:1}        #  ero
                      #  Parameter expansion of first element,
                      #+ starting at position #1 (2nd character).
echo ${#array}        #  4
                      #  Length of first element of array.
echo ${array[2]}
                      # two

<edit> If your doubt isn't clarified yet .... post your code...That will make things easier.

Welcome to LQ

All times are GMT -5. The time now is 05:30 AM.