![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Variable names | Bab00shka | UNIX for Dummies Questions & Answers | 2 | 11-11-2005 07:45 AM |
| echo contents of differing variable names | gefa | Shell Programming and Scripting | 2 | 05-24-2005 04:49 AM |
| KDE names | gnerd | What's on Your Mind? | 1 | 07-18-2004 07:26 AM |
| Variable assignment for file names. | jagannatha | UNIX for Dummies Questions & Answers | 2 | 05-29-2003 01:38 PM |
| Variable names | Bab00shka | Shell Programming and Scripting | 4 | 08-15-2002 08:00 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
awk computed variable names
Is there a way to do make-style computed variable names in awk? e.g. in make
Code:
foo = bar bar = wocket Code:
$($(foo)) thanks |
| Forum Sponsor | ||
|
|
|
|||
|
Thanks for the reply, but that's not exactly what I'm after. That just assigns "wocket" to bar, copies the value of that to foo, then prints the value of foo.
I was wondering if it's possible to say (as in a makefile).... - assign the string "bar" to the variable foo. - assign some string value to the variable bar. - retrieve the value of a variable (in this case bar), where the name of the variable to retrieve from is specified in another variable (in this case foo). So writing $($(foo)) accesses the value of a variable whose name is stored in foo. Klashxx's one is closer to what I need, but it doesn't work if i move the foo=var from the shell into the awk script. I guess this can't be done in awk. I'll workaround it a different way. Thanks |