It is currently Sat, 26 Nov 2022 07:20:39 GMT

Author Message
 korn shell variable in variable access

i try to get the content of a variable from a variable.



build VAR2 using the string "VAR" and the value of n

How can i get "var1_content" using VAR2 ?

$VAR2 => VAR1 !!
${$VAR2} => KO !!!
should i change VAR2 construction


 Mon, 20 Nov 2006 17:49:14 GMT   
 korn shell variable in variable access

eval echo \${$VAR2}

eval VAL=\${$VAR2}

    Chris F.A. Johnson        
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License

 Mon, 20 Nov 2006 18:06:49 GMT   
 korn shell variable in variable access
In article <>,

eval 'echo $VAR'$n

However, it's likely that arrays will solve your problem more cleanly.

Barry Margolin,
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

 Mon, 20 Nov 2006 20:37:17 GMT   
   [ 3 post ] 

Similar Threads

1. detecting difference between unset variable and variable whose value is null in Korn Shell

2. Floating point variables in the Korn shell


4. hlep with passing variables between scripts in Korn Shell

5. Korn Shell 88 PWD Variable

6. Displaying environment variables dynamically in a Korn Shell Script

7. KORN shell environment variable question

8. Korn Shell Variables

9. korn shell variable question

10. Variables getting the return value in Korn shell?

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software