| View previous topic :: View next topic |
| Author |
Message |
toralf Advocate


Joined: 01 Feb 2004 Posts: 2104 Location: Hamburg/Germany
|
Posted: Thu Jan 31, 2008 10:36 am Post subject: [solved] eval a shell variable |
|
|
I try something like this : | Code: | SQL_FOO="select * from foo"
SQL_BAR="select * from bar"
T="FOO"
RESULTS=`$SQL_$T` | Currently I get obviously not the result set from the DB.
My question is, how can I first create a variable name and after that use the _content_ the variable points to ?
Last edited by toralf on Sun Mar 16, 2008 8:19 pm; edited 1 time in total |
|
| Back to top |
|
 |
Voltago Advocate


Joined: 02 Sep 2003 Posts: 2482 Location: Hinter den Materiequellen
|
|
| Back to top |
|
 |
toralf Advocate


Joined: 01 Feb 2004 Posts: 2104 Location: Hamburg/Germany
|
Posted: Thu Jan 31, 2008 12:12 pm Post subject: |
|
|
thanks,
unfortunately I have to code this within ksh under IX 5.3
But this works : | Code: | [tfoerste@detlmtst01] /home/tfoerste> SQL_FOO="select count(id) from adm.agent"
[tfoerste@detlmtst01] /home/tfoerste> T=SQL_FOO
[tfoerste@detlmtst01] /home/tfoerste> eval $(echo db2 \$$T)
1
-----------
23756
1 record(s) selected.
|
|
|
| Back to top |
|
 |
|