Quote:
Originally Posted by Anteus
-----------
Hi thanks.. the code you gave worked.
but further while accessing the array Sam. i am having some issues.
1: When i echo ${Sam[$2]} rather than giving the 2nd element it prints all of them
2: for (( i = 0 ; i < ${#Sam[@]} ; i++ ))
do
echo ${Sam[$i]}
done
its throwing an error
Test[16]: syntax error at line 17 : `((' unexpected
can you please tell how to go about accessing the array..
|
We can not write a for loop like this, unless you are using awk.
I am giving an example of Array and for loop for you...
Code:
set -A _Array 1 2 3 4 5
for i in ${_Array[@]}
do
echo $i
done