![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help in resolving Compilation error | jagan_kalluri | UNIX for Dummies Questions & Answers | 1 | 05-20-2008 03:45 PM |
| DNS not resolving | Mr Pink | UNIX for Advanced & Expert Users | 9 | 05-17-2006 08:22 AM |
| Resolving port 8080 in DNS | korfnz | IP Networking | 1 | 10-18-2004 07:42 PM |
| Resolving ip, detective work | kymberm | IP Networking | 1 | 02-13-2003 05:29 PM |
| Resolving Aliases and Virtual IP's on a Host | Scott Pullen | UNIX for Advanced & Expert Users | 1 | 12-20-2001 02:11 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Resolving Var to its contents
Hello everyone.... I am trying to dinamically create variable names and do resolution of this vars contents. After that is done I want to use (via a function call) the var and its contents by referring to it via the variable name. I am having a hard time achieving this .... can you help ? Example: Code:
#! /bin/ksh
_func2(){
emt=test1_$1
emc=test2_$1
echo $emt
echo $emc
emt=$emt"_EM"
emc=$emc"_EM"
echo $emt
echo $emc
}
Datenow=`date +%Y%m%d%H%M`
test1_x1=/dir1/test/FileOneOne_$Datenow
test1_x2=/dir1/test/FileOneTwo_$Datenow
test2_x1=/dir1/test/FileTwoOne_$Datenow
test2_x2=/dir1/test/FileTwoTwo_$Datenow
test1_x1_EM=/dir1/test/OneOne_$Datenow
test1_x2_EM=/dir1/test/OneTwo_$Datenow
test2_x1_EM=/dir1/test/TwoOne_$Datenow
test2_x2_EM=/dir1/test/TwoTwo_$Datenow
_func2 x1
_func2 x2
When I run this I get the following output, how can I get the variable to resolve to its content? Code:
test1_x1 test2_x1 test1_x1_EM test2_x1_EM test1_x2 test2_x2 test1_x2_EM test2_x2_EM Last edited by vgersh99; 07-20-2009 at 03:37 PM.. Reason: code tags, PLEASE! |
| Bits Awarded / Charged to gio001 for this Post | |||
| Date | User | Comment | Amount |
| 07-20-2009 | vgersh99 | added code tags - charged 3K bits | -3,000 |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|