How can I pass parameter to a *.tcl file

Status
Not open for further replies.

madhusudhan_prabhu

Newbie level 4
Joined
Apr 15, 2008
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,322
Hi,
I want to pass parameter to a tcl file.
e.g.
test.tcl file contains:
set i [lindex $argv 0]
When I use the following command : source test.tcl 9
on the TCL prompt it gives an error.

tcl prompt:
% source test.tcl 9
wrong # args: should be "source fileName"

Please somebody help me.

Regards,
Madhusudhan Prabhu
 

Hi Madusudan,

Can you provide complete script here,that will help to find out issue with that script.
 
Source will accept only one argument that is script name only.
If you want execute the script, just give executable permissions to the script.
If you are in tcl shell,
tcl> exec test.tcl 9
You will have your required o/p.
If u r in unix shell.
unix>./test.tcl 9

Thanks
Teja
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…