egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Run a tcl script from a shell script

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
rbautch
Voice


Joined: 25 Sep 2005
Posts: 3
Location: Chicago

PostPosted: Sun Sep 25, 2005 1:09 am    Post subject: Run a tcl script from a shell script Reply with quote

I want to launch an interactive tcl script from a shell script, but when I try, it seems that the standard input channel gets messed up. For example, the following code:
Code:
puts -nonewline stdout "What is your name?: "
flush stdout set name [gets stdin]

returns the following error:
Code:
error reading "file0": I/O error while executing "gets stdin"

..but the error only occurs when I launch the tcl script from a shell script. It works fine when I run it directly from bash prompt. Any ideas how to fix this?
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Wed Sep 28, 2005 12:59 pm    Post subject: Reply with quote

post your shell script
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
rbautch
Voice


Joined: 25 Sep 2005
Posts: 3
Location: Chicago

PostPosted: Thu Sep 29, 2005 11:59 am    Post subject: Reply with quote

Here is the shell script, which basically just launches two tcl scripts. The first tcl script is not interactive, so it runs fine. The second tcl script chokes when I run it from this script, but works fine when I run it from bash prompt. Thanks in advance.
Code:
#!/bin/sh
tivosh netconfig.tcl
tivosh setSSIDwep.tcl
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Sep 29, 2005 11:07 pm    Post subject: Reply with quote

hmm not much information there... what's tivosh? a TiVo shell? Smile
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
rbautch
Voice


Joined: 25 Sep 2005
Posts: 3
Location: Chicago

PostPosted: Thu Sep 29, 2005 11:25 pm    Post subject: Reply with quote

Tivosh is indeed TivoShell, a customized TCL installation for Tivos. I don't have a Linux PC I can test this on, so can you copy the "test" script from my original post and try to run it from bash?...Then from a simple shell script? Thanks!! Very Happy
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri Sep 30, 2005 5:19 am    Post subject: Reply with quote

just a little note... you are aware that your script is running from sh not from bash?!
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Sep 30, 2005 7:36 pm    Post subject: Reply with quote

De Kus wrote:
just a little note... you are aware that your script is running from sh not from bash?!


on Linux, /bin/sh is merely a symlink to bash
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Sep 30, 2005 8:17 pm    Post subject: Reply with quote

...and yes, it runs fine for me in both cases: when given as argument to tclsh on the shell prompt, and when tclsh is invoked from a shell script
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Sun Oct 02, 2005 11:31 am    Post subject: Re: Run a tcl script from a shell script Reply with quote

rbautch wrote:
I want to launch an interactive tcl script from a shell script, but when I try, it seems that the standard input channel gets messed up. For example, the following code:
Code:
puts -nonewline stdout "What is your name?: "
flush stdout set name [gets stdin]

returns the following error:
Code:
error reading "file0": I/O error while executing "gets stdin"

..but the error only occurs when I launch the tcl script from a shell script. It works fine when I run it directly from bash prompt. Any ideas how to fix this?



are you trying to do something like this ?

Code:
#!/usr/local/bin/tclsh8.4
fileevent stdin readable [list [puts STDIN->[gets stdin]]]
vwait _forever_

_________________
XplaiN but think of me as stupid
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber