help-bash
[Top][All Lists]
Advanced

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

Re: weird interaction between builtin cat and trap


From: Chet Ramey
Subject: Re: weird interaction between builtin cat and trap
Date: Tue, 19 Apr 2022 14:39:26 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.0

On 4/19/22 12:30 PM, Peng Yu wrote:
> https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html
> 
> That is what is written in the bash manual. "When a command terminates
> on a fatal signal whose number is N, Bash uses the value 128+N as the
> exit status."

This is non-responsive.

The issue boils down to your desire to have the builtin cat exit due to
SIGPIPE instead of a write error (-1/EPIPE) in one particular case. You've
never been able to explain exactly why. One non-zero exit status is as good
as the next for things like flow control and error handling.

Your program, or whatever it is, should be able to deal with error
messages written to stderr, so it can't be that. Exact compatibility with
the external /bin/cat is not a requirement, nor is POSIX conformance.
There aren't any bugs here.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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