Determining whether a process is interactive 
Author Message
 Determining whether a process is interactive

I am interested in flagging whether or not a script is being executed
interactively so that I can echo status messages to stdout.  Is there
a dependable and relatively platform independent way to determine
this information?

--
********************************************************************

*  Unix Systems Administrator                   (509) 375-6605     *
*  Battelle Pacific Northwest Laboratories                         *
********************************************************************
*       "I hate quotations."              -- Ralph Waldo Emerson   *
********************************************************************



Wed, 17 Jul 1996 02:53:08 GMT  
 Determining whether a process is interactive
: I am interested in flagging whether or not a script is being executed
: interactively so that I can echo status messages to stdout.  Is there
: a dependable and relatively platform independent way to determine
: this information?

Unfortunately, "interactiveness" is something that only your shell
knows for sure.  However, you can usually tell if any of your
filehandles are redirected from the terminal with something like:

        -t STDIN && -t STDOUT && -t STDERR

But it's perfectly possible for a non-interactive shell script to
invoke your program in such a way that it looks to your program that it
should be interactive.  And often, when this is the case, the
supposedly non-interactive shell script is calling your program for the
very purpose of doing interaction.  About all you can do in this case
is look for a switch that says whether to run interactively.  Note that
many of the shells themselves have a -i switch.

Larry Wall



Thu, 18 Jul 1996 03:52:07 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. interactive process processing

2. determining whether a server supports secure authentication

3. Determining whether direcotry or file

4. How to determine AM or PM time

5. Using perl to control interactive processes?

6. capture of data from a modem from a non-interactive process

7. ? PERL handles interactive process in UNIX ?

8. Open Pipe to Interactive-only Process?

9. Interactive Processes

10. using perl to automate testing of interactive processes

11. ? PERL handles interactive process in UNIX ?

12. How to determine if child process is dead?

 

 
Powered by phpBB® Forum Software