bug-bash
[Top][All Lists]
Advanced

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

Re: builtin echo command redirection misbehaves in detached scripts when


From: Chet Ramey
Subject: Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed
Date: Mon, 10 Sep 2007 09:18:55 -0400
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

Dmitry Potapov wrote:

> 
> Unfortunately, you are right. I did not foresee that some shells may use
> "dup2(open("file.txt"), fileno(stdout))". It is a dirty hack, which may
> cause some other problems. Frankly, I am a bit surprised that bash uses
> printf instead of write(2).  BTW, you cannot use 'printf' in signal
> handlers, so it seems that you cannot use 'echo' in trap commands too.

Luckily, neither of these things is true.

What's needed is a portable interface like BSD's fpurge(3).

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]