Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number of parameter

Status
Not open for further replies.

KSiva

Programmer
Feb 18, 2002
63
AU

Newbie question again!

How do I get number of parameters to a script in TCL. Like in shell, we can get that by $#.

Thanks


Siva
Sivakumar Kandaraj
web system programmer
Melbourne
 
Or, more directly, examine the value of the pre-defined global variable argc.

By the way, note that Tcl handles argc/argv a little differently than in C programming. First, the contents of argv is a Tcl list of the arguments, not an array. Second, the argv list (and the argc count) does not include the program (script) as the first "argument". Thus, it's quite possible for argc to be 0 and argv be an empty list. If you really do need the name used to invoke the script, that information is provided in a separate global variable, argv0. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top