home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!caen!batcomputer!cornell!davis
- From: davis@cs.cornell.edu (Jim Davis)
- Subject: standard output from wish
- Message-ID: <1992Nov10.154459.818@cs.cornell.edu>
- Organization: Cornell Univ. CS Dept, Ithaca NY 14853
- Date: Tue, 10 Nov 1992 15:44:59 GMT
- Lines: 38
-
-
- Mandatory apology: I have searched the Tcl FAQ and all back articles
- before sending these questions.
-
- I want to write some simple, window oriented commands in wish (Tcl).
- I would like these commands to parse command line arguments, to print
- reasonable error messages if the arguments are wrong, and to be able
- to produce output on standard output as a result. But I can't
- find a way to do it.
-
- I tried calling echo but it produces no output. (If I start wish with
- no args, and call echo, I *do* see the output; but if I have a shell
- script with wish as the interpreter, I *don't* see the output; I can
- also do
-
- exec echo "bunch of words" > /dev/console
-
- but I don't want the output to go to the console, I want it to
- go to the place where the user invoked the program.
-
- If I were programming in csh, I would have written something like
-
- if ($#argv > 5) then
- echo "usage: `basename $0` FILE [-switch baz] "
- exit 1
- endif
-
- What's the Tcl/wish equivalent?
-
- I can use error, but it produces a lot of output including a trace of
- the internal location within the script; this does not belong in the
- error message.
-
- In the more general case, I'd like to be able to send stuff to std
- output so that I can do other things from the shell with the results
- of my Tcl program.
-
- best wishes
-