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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
use variable for sed print line atchleykl UNIX for Dummies Questions & Answers 3 02-23-2009 01:49 PM
How to print a value in the variable using awk ? jisha Shell Programming and Scripting 1 01-14-2008 07:45 AM
print variable in file using awk kamel.seg Shell Programming and Scripting 3 01-03-2008 06:43 AM
can awk print column using a variable ?? jambesh Shell Programming and Scripting 36 09-26-2006 07:39 AM
print variable in awk kazanoova2 Shell Programming and Scripting 8 05-17-2004 06:30 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-06-2006
sun-guy sun-guy is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 3
Question print the name of variable

How can I pass the name of the variable inside a for statment
I have a script something like below:

classA=12
classB=14
classC=16
# classD = 20

all_class="classA classB classC"

for i in $all_class
do
echo $i = $($i) #<---- this one not work
#echo $i = $(echo $i) # <---- this one not work too
#echo classA = $classA # <----- it can pass the classA = 12
done

Also, how can i do if i don't know how many class will be there and i don't want to change the all_class value ?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0