Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 06: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, 09:44
georgev georgev is offline
SQL Apprentice
 
Join Date: Jan 2007
Location: hiding
Posts: 8,143
Are you looking for concatenation?
__________________
George
You only stop learning when you stop asking questions.
Reply With Quote
  #3 (permalink)  
Old 10-10-07, 10: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, 13: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

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