View previous topic :: View next topic |
Author |
Message |
rbautch Voice
Joined: 25 Sep 2005 Posts: 3 Location: Chicago
|
Posted: Sun Sep 25, 2005 1:09 am Post subject: Run a tcl script from a shell script |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Wed Sep 28, 2005 12:59 pm Post subject: |
|
|
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 |
|
 |
rbautch Voice
Joined: 25 Sep 2005 Posts: 3 Location: Chicago
|
Posted: Thu Sep 29, 2005 11:59 am Post subject: |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Sep 29, 2005 11:07 pm Post subject: |
|
|
hmm not much information there... what's tivosh? a TiVo shell?  _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
Back to top |
|
 |
rbautch Voice
Joined: 25 Sep 2005 Posts: 3 Location: Chicago
|
Posted: Thu Sep 29, 2005 11:25 pm Post subject: |
|
|
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!!  |
|
Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri Sep 30, 2005 5:19 am Post subject: |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Sep 30, 2005 7:36 pm Post subject: |
|
|
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 |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Sep 30, 2005 8:17 pm Post subject: |
|
|
...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 |
|
 |
Ofloo Owner
Joined: 13 May 2003 Posts: 953 Location: Belguim
|
Posted: Sun Oct 02, 2005 11:31 am Post subject: Re: Run a tcl script from a shell script |
|
|
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 |
|
 |
|