home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / tcl / 1261 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.4 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!gmd.de!borneo.gmd.de!richard
  2. From: richard@borneo.gmd.de (Richard Czech)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: exec output file format (can't say exec foo > stdout)
  5. Message-ID: <1992Aug27.104816.29283@gmd.de>
  6. Date: 27 Aug 92 10:48:16 GMT
  7. References: <1992Aug26.211548.22311@osf.org>
  8. Sender: news@gmd.de (USENET News)
  9. Reply-To: richard@borneo.gmd.de
  10. Organization: GMD, German National Research Center for Computer Science
  11. Lines: 23
  12. Nntp-Posting-Host: hawaii
  13.  
  14. In article <1992Aug26.211548.22311@osf.org>, pnh@pmin24.osf.org (Peter Harbo)
  15. writes:
  16. |> I recently wanted to use the exec command to send the output of a UNIX
  17. |> command
  18. |> directly to standard output rather than returned as a TCL result like so
  19. |> 
  20. |>     exec date > stdout
  21. |> 
  22. |> using the "stdout" filename.  Unfortunately exec does not work like "puts"
  23. |> which calls TclGetOpenFile() to translate "stdout" to a file descriptor,
  24. |> instead it apparently calls Tcl_CreatePipeline() to open the file following
  25. |> '>' via open(), ergo no translation.
  26.  
  27. Try this:
  28.  
  29.     puts stdout [exec date]
  30.  
  31. ----------------------------------------------------------------------
  32.         Richard Czech                        e-mail:      czech@gmd.de
  33.          GMD-I5-FIT
  34.         P.O.Box 13 16                        phone: (+49) 2241 14 2039
  35. D-5205 St. Augustin 1, Germany               fax:   (+49) 2241 14 2342
  36. ----------------------------------------------------------------------
  37.