home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / perl / 6922 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.5 KB  |  48 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!caen!batcomputer!cornell!davis
  3. From: davis@cs.cornell.edu (Jim Davis)
  4. Subject: standard output from wish
  5. Message-ID: <1992Nov10.154459.818@cs.cornell.edu>
  6. Organization: Cornell Univ. CS Dept, Ithaca NY 14853
  7. Date: Tue, 10 Nov 1992 15:44:59 GMT
  8. Lines: 38
  9.  
  10.  
  11. Mandatory apology:  I have searched the Tcl FAQ and all back articles
  12. before sending these questions.
  13.  
  14. I want to write some simple, window oriented commands in wish (Tcl).
  15. I would like these commands to parse command line arguments, to print
  16. reasonable error messages if the arguments are wrong, and to be able
  17. to produce output on standard output as a result.  But I can't
  18. find a way to do it.
  19.  
  20. I tried calling echo but it produces no output.  (If I start wish with
  21. no args, and call echo, I *do* see the output; but if I have a shell
  22. script with wish as the interpreter, I *don't* see the output; I can
  23. also do
  24.  
  25. exec echo "bunch of words" > /dev/console
  26.  
  27. but I don't want the output to go to the console, I want it to
  28. go to the place where the user invoked the program.
  29.  
  30. If I were programming in csh, I would have written something like
  31.  
  32. if ($#argv > 5) then
  33.   echo "usage: `basename $0`  FILE [-switch baz] "
  34.   exit 1
  35. endif
  36.  
  37. What's the Tcl/wish equivalent?
  38.  
  39. I can use error, but it produces a lot of output including a trace of
  40. the internal location within the script; this does not belong in the
  41. error message.
  42.  
  43. In the more general case, I'd like to be able to send stuff to std
  44. output so that I can do other things from the shell with the results
  45. of my Tcl program.
  46.  
  47. best wishes
  48.