Alex Rivera | Logout

tcl command redirect to a variable, tcl version is 8.4

Asked 2010-10-06T19:14:55.057
11

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?

Edit
Report

1 Answer

0

Before anyone comes up with an elegant solution, I share my ugly last resort:

find_transistor m* > tmp
set fp [open "tmp" r]
set file_data [read $fp]
close $fp

Bear in mind that the output of the command should be relatively small.

answered 2011-08-29T03:23:37.537

Your Answer