Alex Rivera | Logout

How to run tcl script inside other tcl script?

Asked 2012-02-14T10:13:14.500
18

I have two tcl scripts. I want to run the second script when the first finished. How can I do it?

tcl
Edit
Report

1 Answer

23

Depends on what do you really mean.

One way is to write a third ("master") script which would do

source /the/path/to/the/first.tcl
source /the/path/to/the/second.tcl

Another way is to just add the second call to source from the above example to the bottom of the first script.

Amendment to the first approach: if the scripts to be executed are located in the same directory as the master script, an idiomatic way to source them is

set where [file dirname [info script]]
source [file join $where first.tcl]
source [file join $where second.tcl]

This way sourcing will work no matter what the current process's directory is and where the project directory is located.

answered 2012-02-14T11:18:44.307

Your Answer