#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Posts
    11
    Rep Power
    0

    Parameter variables help


    Hello,

    I took a small text file with one word on each line and used the "set" command.
    I am trying to take one variable with an integer, lets say $x
    and and use that integer to retrieve the parameter variable.
    So if $x = 2 and I wanted to use that variable to make the parameter variable $2, what syntax would I use for that?
    I've tried some combinations to no avail.
    $$x would obviously give the pid+x
    $"$x" doesn't work and so on.
    Any help is appreciated.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,451
    Rep Power
    1751
    Try:

    Code:
    eval y=\$$x
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Posts
    11
    Rep Power
    0
    Thank you.
    eval made all of the difference. I'm still not entirely sure what eval can do, but it certainly worked in this instance.

IMN logo majestic logo threadwatch logo seochat tools logo