Loading
View RSS Feed

Goldsonam's Blog

How To Use Array In Shell Script?

Rating: 8 votes, 3.50 average.
Only noteworthy in this program is the syntax for the usage of arrays.

Code:
Code:
echo "ENTER THE NO. OF ARRAY ELEMENTS"
read n
i=1
while [ $i -le n ]
 do 
   read a[$i]
   let i = $i + 1
 done

i=1
while [ $i -le n ]
 do 
   echo ${a[i]}
   let i = $i + 1
 done

Submit "How To Use Array In Shell Script?" to Digg Submit "How To Use Array In Shell Script?" to del.icio.us Submit "How To Use Array In Shell Script?" to StumbleUpon Submit "How To Use Array In Shell Script?" to Google

Updated 03-03-2011 at 06:37 PM by Harsh

Categories
Unix

Comments




Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.