If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Dynamic variable name

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-10-07, 05:00
AngelMady AngelMady is offline
Registered User
 
Join Date: Oct 2007
Posts: 4
Dynamic variable name

Hy,

In a ksh I want to do this:

I have

ficVL="abc1"
var1="fic"
var2="VL"

and var3 should be assign with the value of ficVL but not in the usual way ( var3=$ficVL ). Something more like var3= $var1$var2. Anyway this method is not working to do what I want.

Is there a magic trick to do this?

Thanks in advance for your answers,

Madalina
Reply With Quote
  #2 (permalink)  
Old 10-10-07, 08:44
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Are you looking for concatenation?
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 10-10-07, 09:13
radoulov radoulov is offline
Registered User
 
Join Date: May 2007
Location: Milano, Italy
Posts: 22
Quote:
Originally Posted by AngelMady
Hy,

In a ksh I want to do this:

I have

ficVL="abc1"
var1="fic"
var2="VL"

and var3 should be assign with the value of ficVL but not in the usual way ( var3=$ficVL ). Something more like var3= $var1$var2. Anyway this method is not working to do what I want.
[...]
If I understand correctly:

Code:
$ ficVL="abc1"
$ var1="fic"
$ var2="VL"
$ eval "var3=\$$var1$var2"
$ echo "$var3"
abc1
Reply With Quote
  #4 (permalink)  
Old 10-10-07, 12:07
AngelMady AngelMady is offline
Registered User
 
Join Date: Oct 2007
Posts: 4
Thank you Thank you Thank you Thank you
That was exactly my point.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On