The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Enviornment Variable in B shell (I call it nested variable) princelinux Shell Programming and Scripting 4 07-01-2008 10:35 PM
Urgent-reading a variable value kaaakrishna UNIX for Advanced & Expert Users 3 06-16-2008 12:51 AM
Urgent-Reading eval result in a variable kaaakrishna UNIX for Advanced & Expert Users 1 06-14-2008 06:03 AM
how to store the first content of the folder in a variable?(Urgent) sunitachoudhury Shell Programming and Scripting 3 04-08-2008 12:11 AM
Urgent!! Bash - problem using CD with variable jacksam007 Shell Programming and Scripting 1 01-17-2007 07:10 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 4 Weeks Ago
Registered User
 

Join Date: Aug 2008
Posts: 12
New Variable with Existing variable( Urgent)

hi all,

i want use the variable value as a new variable name. print output of new variable.


for i in COMPUTER1 COMPUTER2
do
flag_name=${i}_FLAG
eval ${flag_name}=123
echo $i'_FLAG'
done

output is
COMPUTER1_FLAG
COMPUTER2_FLAG

i need output as
123
123
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 4 Weeks Ago
ynilesh's Avatar
Registered User
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 162
Try using shell indirect reference.

- nilesh
Reply With Quote
  #3 (permalink)  
Old 4 Weeks Ago
Registered User
 

Join Date: Jul 2008
Posts: 22
Hi Aravind,

Basically eval can be used only for manipulating some numbers , i think u can use just a

variable assignment....

$\{flag_name\}=123

Kindly try this and send output...
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:33 AM.


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