| View previous topic :: View next topic |
| Author |
Message |
TurboPropp Voice
Joined: 20 Oct 2007 Posts: 1
|
Posted: Sat Oct 20, 2007 8:54 am Post subject: Help with tcl -> sh |
|
|
Ok.. I'm kinda new to tcl scripting
I know you can run a .sh script from tcl using "exec"
And to run a tcl file from sh u can use "tclsh"
So my bot's script, runs a .sh file, and when the .sh file is done it then runs a new .tcl file. But that new .tcl file is not "connected" to the eggdrop so commands like "putmsg $chan" does not work.
Is there any way to make them "connect" ?
Or another solution would be to make the tcl script wait until the .sh script was done, and then go on, but dont know how to do that either  |
|
| Back to top |
|
 |
TCL_no_TK Owner

Joined: 25 Aug 2006 Posts: 509 Location: England, Yorkshire
|
Posted: Mon Oct 22, 2007 9:22 am Post subject: |
|
|
Whats the .sh file used for? If its written in tcl you can just change it so eggdrop can use it which pretty much means # mv file.sh file.tcl _________________ TCL the misunderstood |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Oct 22, 2007 10:40 am Post subject: |
|
|
Simply put, using exec spawns a new child-process, where the only connection inbetween the processes is the stdout and stderr pipe from the child, which is returned to the tcl environment as return-value of exec once the child is terminated.
As such, any script or command run as or by the child will be completely unaware of the eggdrop environment. There is no simple way of "connecting" them as you describe. You could relay data inbetween the processes using sockets, although you'd have to create an API for that.
One question though, if you need eggdrop functionability in your secondary tcl-script, why don't you run it directly from eggdrop's tcl-environment? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
BeBoo Halfop
Joined: 26 Sep 2007 Posts: 42
|
Posted: Tue Oct 23, 2007 10:58 am Post subject: |
|
|
| Is the sh script called from an already existing tcl script via the bot? If so, you would probably want the sh script to move the tcl to your scripts folder and have it modify your eggdrop.conf file. Once it's complete, have your tcl script you called originally to rehash your bot. |
|
| Back to top |
|
 |
|