This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help with tcl -> sh

Help for those learning Tcl or writing their own scripts.
Post Reply
T
TurboPropp
Voice
Posts: 1
Joined: Sat Oct 20, 2007 7:28 am

Help with tcl -> sh

Post by TurboPropp »

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 :P
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

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
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
B
BeBoo
Halfop
Posts: 42
Joined: Wed Sep 26, 2007 1:44 am

Post by BeBoo »

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.
Post Reply