tcl command redirect to a variable, tcl version is 8.4

Lior Dagan picture Lior Dagan · Oct 6, 2010 · Viewed 21.9k times · Source

I want to redirect the output of 1 command to a variable, where the OUTPUT is usually to STDOUT. I am running an EDA tool, which has tcl interpeter & it's own commands. Let's say that the tool has a tcl query, which says

TOOL> find_transistor m*
m1 m2 m3 m4

I want to have a way of doing the following:

TOOL> set ret redirect {find_transistor m*}
TOOL> puts $ret
m1 m2 m3 m4

Any ideas?

Answer

Ray picture Ray · Feb 21, 2012

This might work:

redirect -variable ret {find_transistor m*}

puts $ret