| |||||||||||
Tcl commands execution from two fifferent files Posted by pgpatel (pgpatel), 26 July 2005 Hi allI am new in this forum... i have question regarding tcl... I want to execute some tcl commands in particular sequence...commands are depend on one another... For example commands are create ,connect ,get_result,save result etc.... Now i want to make two script file with some commands...one file with create and connect...and another file with get_result and save result.... and now i want to execute this two file.... first file i can execute...after that i want to execute something else and then again i want to execute 2nd file ...how can i maintain continuation between 1st and 2nd file? i donot want to execute commands in first file again... please help me.. thanks in advance.... Posted by admin (Graham Ellis), 26 July 2005 Have a look at the source command that lets you call up one file from within another.Here's an example - a simple file called t1 calls up the code in a second file called t2 through the source command: Code:
Posted by pgpatel (pgpatel), 26 July 2005 Thanks for reply...but i know this thing.. and source command execute all the commands in the file... and i donot want to execute it again....i am clearing the question.... suppose this is my code: file1.tcl file.tcl filex.tcl file2.tcl and i want the continuation between file 1 and file 2 without reexecuting commands in file 1... awaiting for a favourable reply... Posted by admin (Graham Ellis), 26 July 2005 The source command pauses the execution of the current file and causes the named file to be run before the current file is resumed. If it's the very last executable statement in a file, in effect it chains two files together.If you want to execute all the contents of file1 then all the contents of file2, you can either: add source file2 as an extra line at the end of file1 or create a new file which contains source file1 source file2 and then run that file as your complete Tcl program. Posted by pgpatel (pgpatel), 26 July 2005 Thanks for reply again....But i want to execute those files remotely.... with ssh command line as two differene command.... now please suggest me Posted by admin (Graham Ellis), 26 July 2005 on 07/26/05 at 20:05:28, pgpatel wrote:
OK - that's not something that I got from your initial two posts ... On the brief specification that you've given me, I would probably suggest that you have a look at the Expect extension to Tcl, but there's all sorts of other questions that I would have to ask you to go into more detail of exactly how it would work for you. Can I suggest that you start off by having a look at (and following links from http://expect.nist.gov. You should find tutorials, examples, downloads, articles, etc there ... far too much for me to put into an Opentalk post. Expect programming isn't always easy, so if you get to the stage of having written some code but you're not able to get it to work exactly as you would wish, please do start another thread up and post a code sample so that we can help. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |