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


Joined: 01 Feb 2004 Posts: 1139 Location: Hamburg/Germany
|
Posted: Thu Jan 31, 2008 5: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 3:19 pm; edited 1 time in total |
|
| Back to top |
|
 |
Voltago Veteran


Joined: 02 Sep 2003 Posts: 2237 Location: Hinter den Materiequellen
|
|
| Back to top |
|
 |
toralf Veteran


Joined: 01 Feb 2004 Posts: 1139 Location: Hamburg/Germany
|
Posted: Thu Jan 31, 2008 7:12 am 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 |
|
 |
|