set dataList { {eval echo "my command"} dataItem1 dataItem2.....}
foreach data $dataList {
$dataList
}
knowing that that dataItem1 dataItem2 .... are all commands and that echo is
a command that needs to evalutaed... can you just use $dataList to get it to
run the eval command or how could you accomplish something like this?
Eric :D
lappend lst [list puts one]
lappend lst [list puts two]
lappend lst [list puts three]
foreach script $lst {
eval $script
}
Embedding the [eval] in $script is a bad idea.
Ciao,
Marco
--
"Love & Peace" -- Vash the Stampede
With this though it will eval all one two and three commands .. i just would
like one of the list commands to be evaluated and the rest to be executed.
:)
Executed like in "execute an external command" ? If so:
lappend lst $script_that_when_evaluated_returns_a_command
lappend lst $command_arg1 $command_arg2 $command_arg3
set command [namespace eval :: [lindex $lst 0]]
eval exec $command [lrange $lst 1 end]
example:
lappend lst {auto_execok ls}
lappend lst --size --kilobytes
set command [namespace eval :: [lindex $lst 0]]
set result [eval exec $command [lrange $lst 1 end]]
TCL evaluates scripts the global namespace.
Yep. Isn't Tcl fun? :-) Just follow the rules on Tcl.n and it works.