In a message dated: Fri, 07 Jun 2002 14:26:34 EDT
Benjamin Scott said:

>On Fri, 7 Jun 2002, at 2:00pm, [EMAIL PROTECTED] wrote:
>> Ahm, I don't think you can, since the shell is sending to STDOUT in this
>> case, and STDOUT has been redirected at *shell* level to be someplace
>> other than STDOUT; in this case, a file.
>
>  STDOUT is simply file descriptor 1.  (STDIN is FD 0, STDERR is FD 2.)  
>All a shell does when it sets up redirection is close the appropriate FD,
>and then re-open it on another file (using the dup2(2) system call (I
>think)).  The program being redirected simply outputs to the appropriate FD.
>
>  As Michael O'Donnell points out, you can use the -t "test" to determine if
>a FD number is a tty or not.  I expect that simply makes use of the
>"isatty(3)" library call.

Right, but aren't there essentially 2 STDOUTs here?  What the script 
thinks is STDOUT and what the parent shell thinks is STDOUT?
In other words, the shell script has it's own copies of FDs 0,1, and 2
separate from that of the parent shell which spawned it.  The parent 
shell is being told take all output from this script and throw it 
into this file.  Whereas the script is being told, throw everything 
to STDOUT.

Oh, wait, you just mentioned dup(2), never mind, I think I just 
realized the error of my reasoning (or lack thereof :)
-- 

Seeya,
Paul
----
        It may look like I'm just sitting here doing nothing,
   but I'm really actively waiting for all my problems to go away.

         If you're not having fun, you're not doing it right!



*****************************************************************
To unsubscribe from this list, send mail to [EMAIL PROTECTED]
with the text 'unsubscribe gnhlug' in the message body.
*****************************************************************

Reply via email to