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: <slebetman@yahoo.com>
Date: Mon Dec 19 2005 - 10:40:35 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.

You forgot to call the tcl interpreter:

  exec tclsh xyz.tcl a b c
  exec tclsh jkl.tcl d e f

Actually, doing source will also work, just manually set argv and argc:

  global argc argv
  set argv "a b c"
  set argc [llength $argv]
  source xyz.tcl
Received on Fri Dec 23 19:02:04 2005