Jeff Abrahamson on Wed, 9 Oct 2002 20:20:06 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] shell without tty


On Wed, Oct 09, 2002 at 03:19:53PM -0400, christophe barbe wrote:
> On Wed, Oct 09, 2002 at 12:17:07PM -0400, gabriel rosenkoetter wrote:
> > On Tue, Oct 08, 2002 at 10:00:19PM -0400, christophe barbe wrote:
> > > I am trying to tweak a shell to invoke a program (gettextize) without
> > > providing a tty. Basically gettextize check if there is a tty (with
> > > isatty) and if yes bother me (and others) with a useless "Press Enter
> > > ..." message.
> > > 
> > > Is there a way in bash or perl to do this?
> > 
> > In Perl, yes. Either use Expect or Term::Read{Line,Key}.
> > 
> > (No need to reinvent the wheel; it's already been generalized.)
> 
> Thanks gabe,
> 
> I was trying to close the tty but it is simplier to provide an ENTER
> when expected. Expect does that easily.

Well, just to beat a dead horse, you can also fool your script by
saying

    cat | my-script | cat

There, neither stdin nor stdout is a terminal, but it is. Of course,
you may get block-buffered i/o. So then you end up saying

    perl -wp '{$|=1; <>;}' | my-script | cat

But unless my-script chooses to flush stdout after each line, you'll
still get block-buffered output.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>

_________________________________________________________________________
Philadelphia Linux Users Group        --       http://www.phillylinux.org
Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug