I'm trying to "source" a tcl script, but I need to provide arguments
to it.
When running the program from the tclsh, I can provide arguments but
if I want to run it from within another script, it does not work.
Can someone help me ?
Thanks
Renaud
set argv [list "the" "arguments" "you" "want"]
set argc [llength $argv]
source yourScript.tcl
--
| Don Porter Mathematical and Computational Sciences Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
I wrote this little proc a while ago in response to a similar question:
Or in case that link doesn't work for you, a slightly modified version:
proc src {file args} {
set argc $::argc
set argv $::argv
set ::argc [llength $args]
set ::argv $args
uplevel [list source $file]
set ::argc $argc
set ::argv $argv
}
Then you can do:
% src yourfile.tcl arg1 arg2 arg3
--
Mark G. Saye
markgsaye @ yahoo.com
Thanks a lot to everybody.
Renaud