Re: Calling one tcl script from another with parameters
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Calling one tcl script from another with parameters

From: Ronnie Brunner <ronnie.brunner@netcetera.ch>
Date: Mon Dec 19 2005 - 11:01:56 CET

Ranjan wrote:
> I am presently running a Tcl code from cygwin as follows:
>
> ./xyz.tcl a b c
>
> here xyz is the script name and a, b, c are the command line
> parameters tha
> t I am passing to the script.
>
> Now I want to write another master script where are want to call such
> indivi
> dual scripts (having command line parameter). "source" command does not
> allo
> w to attach parameters with it. I tried the following was :
>
> for {...} {...} {...} {
> exec xyz.tcl a b c
> exec jkl.tcl d e f
> .
> .
> .
> }
> but this is not working . Is there any way to do this.

In xyz.tcl you obviously access the argv argc (and possibly arv0)
variables. Just set them before you source your script:

set argv [list a b c]
set argc [llength $argv]
source xyz.tcl

hth

Ronnie

-- 
--
Ronnie Brunner | ronnie.brunner@netcetera.ch
phone +41 (0)44 247 79 79 | fax +41 (0)44 247 70 75
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.ch
Received on Fri Dec 23 19:02:04 2005