|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Variable value not getting printed
Hi, I ma trying to do this but don't know why it is not happening? Code:
$r1=10
for i in "1" "2" "3" "4"; do x=`eval echo $i`; echo r${x}; doneoutput: Code:
r1 r2 r3 r4 also tried Code:
for i in "1" "2" "3" "4"; do x=`eval echo $i`; echo $r${x}; doneoutput: Code:
1 2 3 4 why I am not able to get the value of r1...Where I am geting wrong? Regards Abhinav Last edited by Scott; 01-04-2013 at 07:58 AM.. Reason: Code tags, please... |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
In your code Code:
for i in "1" "2" "3" "4"; do x=`eval echo $i`; echo $r${x}; doneThere is no such variable called "r". Highlighted above
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
there is a variable r1=10.. ![]() ---------- Post updated at 05:58 PM ---------- Previous update was at 05:32 PM ---------- Done with this... Code:
for i in "1" "2" "3" "4"; do eval echo \${r${i}}; doneThanks Last edited by Scott; 01-04-2013 at 07:59 AM.. Reason: Code tags |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need to limit the status printed | anandek | Shell Programming and Scripting | 1 | 09-26-2012 09:38 AM |
| Value printed by gdb does not consist with the right value | 915086731 | Programming | 1 | 10-17-2011 06:18 AM |
| Messages printed in the shell | mregine | UNIX for Dummies Questions & Answers | 7 | 09-08-2011 01:07 AM |
| lp - order of files printed | mabrownawa | UNIX for Advanced & Expert Users | 2 | 02-16-2004 11:08 AM |
|
|