ns FILENAME ARG1 ARG2 ... |
|
puts "There are $argc arguments to this script"
puts "The name of this script is $argv0"
if {$argc > 0} {puts "The other arguments are: $argv" }
set k 1
foreach i $argv {
puts "arg $k is $i"
incr k
}
|
(The foreach loop was discussed in this webpage: click here )
How to run program:
puts "There are $argc arguments to this script"
puts "The name of this script is $argv0"
if {$argc > 0} {puts "The other arguments are: $argv" }
for {set i 0} {$i < [llength $argv]} {incr i} {
puts "arg $i is [lindex $argv $i]"
}
|
(The for loop was discussed in this webpage: click here )
How to run program:
Thus, if the file contains procedure definitions, Tcl will learn the new commands.
source FILENAME |