13.32.7.2 Special Arguments (Command-line Parameters)
You can determine the name of the Tcl script file while executing the Tcl script by referring to the $argv0 variable.
puts “Executing file $argv0”
To access other arguments from the command line, you can use the lindex command and the argv variable: To read the the Tcl file name:
lindex $argv 0
To read the first passed argument:
lindex $argv 1
Example
puts "Script name is $argv0" ; # accessing the scriptname puts "first argument is [lindex $argv 0]"
puts "second argument is [lindex $argv 1]" puts "third argument is [lindex $argv 2]" puts "number of argument is [llength $argv]" set des_name [lindex $argv 0]
puts "Design name is $des_name"
