Piping commands in TCLSH
Posted by neo (The Architect), 1 May 2005How can I pipe commands in a TCL script or in the TCL shell?
Posted by admin (Graham Ellis), 1 May 2005Use "puts" to send the output of your script to STDOUT, then use a "|" followed by the command you want to send your output to on the command line.
Posted by neo (The Architect), 1 May 2005Here is the output..
Posted by admin (Graham Ellis), 1 May 2005Here's an example of what I meant ... using | in the shell not in Tcl.
Posted by neo (The Architect), 2 May 2005Ok.
So does the TCL shell (tclsh) as such support piping?
Posted by admin (Graham Ellis), 2 May 2005The pipe character (|) has no special significance in Tcl - so, no, the Tclsh shell doesn't itself support piping. That's why the I suggested that you use a shell pipe in answer to your first question.
You've really got two options to pipe commands in Tcl; you can follow my shell suggestion as made earlier in thsi thread, or you can use the open command with a pipe character as the first character of what would (otherwise) by the file name. There's an example on our web site at http://www.wellho.net/resources/ex.php4?item=t209/disc_status.
Other Forum Posts
Follow us on ...
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho