tags:

views:

35

answers:

1

Hello all. 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?

+4  A: 

well in pure Tcl

set ret [find_transistor m*]

would probably do what you want. Try reading the Tcl tutorial.

Jackson
This won't work if "find_transistor" writes its result to stdout. All your example does is save whatever `find_transistor` returns, which unfortunately is not what the question is asking.
Bryan Oakley
You are of course correct - if the command really is writing to STDOUT then a different approach will be required. We really need the originator of the question to come back and talk to us!
Jackson