2018-12-06

Tcl: argv

argv

$argv is a global variable provided by tclsh and wish mainline code.


下面就是 Tcler's wiki 的範例(我只有改寫第一行):
#!/usr/bin/env tclsh

if { $::argc > 0 } {
    set i 1
    foreach arg $::argv {
        puts "argument $i is $arg"
        incr i
    }
} else {
    puts "no command line argument passed"
}

沒有留言: