home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!ghostwind!shmdgljd
- From: shmdgljd@rchland.vnet.ibm.com (Jay Schmidgall)
- Subject: Re: standard output from wish
- Sender: news@rchland.ibm.com
- Message-ID: <1992Nov10.185846.16970@rchland.ibm.com>
- Date: Tue, 10 Nov 1992 18:58:46 GMT
- Reply-To: jay@vnet.ibm.com
- Disclaimer: This posting represents the poster's views, not necessarily those of IBM
- References: <1992Nov10.171427.6285@cs.cornell.edu>
- Nntp-Posting-Host: ghostwind.rchland.ibm.com
- Organization: IBM Rochester, MN
- Lines: 26
-
- In article <1992Nov10.171427.6285@cs.cornell.edu>, davis@cs.cornell.edu (Jim Davis) writes:
- |> if ($#argv > 5) then
- |> echo "usage: `basename $0` FILE [-switch baz] "
- |> exit 1
- |> endif
- |> What's the Tcl/wish equivalent?
-
- Unfortunately, wish hides what would be argv[0] from you, so I don't
- know any nifty way to get your script name other than hardcoding it.
-
- Granting that, you could do
-
- set programName {foo}
- if {[set argc [llength $argv]] > 5} {
- puts stderr [format {usage: %s FILE [-switch baz]} $programName]
- exit 1
- }
- puts stdout "argv is ($argv), argc is $argc"
- exit 0
-
- If you're using wish built with extended tcl, programName will be set for
- you, I believe.
-
- --
- : jay jay@vnet.ibm.com My opinions and ideas, not my employer's.
- : shmdgljd@rchland.vnet.ibm.com (c) Copyright 1992. All rights reserved.
-