argc

argc is a global namespace Tcl variable set by tclsh, wish and other code doing similar setup.

It contains a count of the number of arguments passed to the command upon invocation.

The count begins at 1, and the count does not include the name of the script itself (which in tclsh can be found in argv0) or the name of the Tcl interpreter (which is reported by info nameofexecutable) (both of which are different from C's argc).

# program usage requires at least one argument
if { $::argc eq 0 } {
   puts "USAGE: $::argv0 argument"
   exit 1
}

See also