Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    4

    Unanswered: 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

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Are you looking for concatenation?
    George
    Home | Blog

  3. #3
    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

  4. #4
    Join Date
    Oct 2007
    Posts
    4
    Thank you Thank you Thank you Thank you
    That was exactly my point.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •