The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to store values into variable in perl chittiprasad15 Linux 3 05-07-2008 09:21 PM
can array store float point numbers naree SUN Solaris 1 03-05-2008 02:59 AM
How to store the values in a file into an array risshanth UNIX for Dummies Questions & Answers 3 01-22-2008 06:34 AM
How to store query multiple result in shell script variable(Array) div_Neev Shell Programming and Scripting 4 11-06-2007 04:10 PM
split varibles and store fields into shell varible array gratus Shell Programming and Scripting 3 10-11-2007 11:50 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-17-2001
Registered User
 

Join Date: Aug 2001
Posts: 60
Stumble this Post!
how do I store the values in array using shell

Hi,

Is is possible to get the value using shell script?

x=1
y1 = 10
y2 = 15
y3 = 7

echo $y$x is giving y1 (variable name)
but I need the value of y1 (i.e. 10 dynamically)


Is there any solution?

if so, please mail me at kkodava@maxis.com.my

Thanx
Forum Sponsor
  #2 (permalink)  
Old 08-17-2001
Registered User
 

Join Date: May 2001
Location: Germany
Posts: 15
Stumble this Post!
set -A VARNAME 1 10 15 <- init array

echo ${VARNAME[0]} giving 1
echo ${VARNAME[2]} giving 15

to initialize the array you can also do thing like this(in ksh scripts)

set -A VARNAME $(ls)

try it
  #3 (permalink)  
Old 08-17-2001
Registered User
 

Join Date: Aug 2001
Posts: 60
Stumble this Post!

Thanks michael,

I will try.

krishna
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0