The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 06-15-2009
Anteus Anteus is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 54
Quote:
Originally Posted by rakeshawasthi View Post
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

Yeah . but what to do if only the second element of the array Sam has to be echoed..

and why does echo ${Sam[$2]} prints the entire Sam array??