Prev: Regex batch filename modification in working directory?
Next: (bash) Help with 'let', ?:, and pattern matching
From: contracer on 9 Aug 2010 10:41 Hi, Can you help me with evaluating variables ? >> cat g5 #!/bin/ksh descr940="DataStaging System" for INT in 940 do echo $descr$INT done >> ./g5 940 (I need 'DataStaging System' output)
From: Janis Papanagnou on 9 Aug 2010 11:08 contracer schrieb: > Hi, > Can you help me with evaluating variables ? > >>> cat g5 > > #!/bin/ksh > descr940="DataStaging System" > > for INT in 940 > do > echo $descr$INT eval echo \$descr$INT > done > > >>> ./g5 > 940 > > (I need 'DataStaging System' output) See above. Janis
From: contracer on 9 Aug 2010 11:11 On 9 ago, 12:08, Janis Papanagnou <janis_papanag...(a)hotmail.com> wrote: > contracer schrieb: > > > Hi, > > Can you help me with evaluating variables ? > > >>> cat g5 > > > #!/bin/ksh > > descr940="DataStaging System" > > > for INT in 940 > > do > > echo $descr$INT > > eval echo \$descr$INT > > > done > > >>> ./g5 > > 940 > > > (I need 'DataStaging System' output) > > See above. > > Janis Thanks so much ! Regards.
From: Ed Morton on 9 Aug 2010 12:16
On Aug 9, 10:11 am, contracer <contrace...(a)gmail.com> wrote: > On 9 ago, 12:08, Janis Papanagnou <janis_papanag...(a)hotmail.com> > wrote: > > > > > > > contracer schrieb: > > > > Hi, > > > Can you help me with evaluating variables ? > > > >>> cat g5 > > > > #!/bin/ksh > > > descr940="DataStaging System" > > > > for INT in 940 > > > do > > > echo $descr$INT > > > eval echo \$descr$INT > > > > done > > > >>> ./g5 > > > 940 > > > > (I need 'DataStaging System' output) > > > See above. > > > Janis > > Thanks so much ! > Regards.- Hide quoted text - > > - Show quoted text - Why are you doing that though? If you REALLY wanted a script to do that then you should use awk or similar: $ cat ./g5 awk 'BEGIN{ descr[940]="DataStaging System" for (INT in descr) { print descr[INT] } exit }' $ ./g5 DataStaging System Regards, Ed. |