LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   shell script array problem (https://www.linuxquestions.org/questions/programming-9/shell-script-array-problem-101903/)

rche3252 10-09-2003 12:18 AM

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-09-2003 12:43 AM

This is how arrays are used....

Code:

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 12:12 AM.