[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trap 'echo "trap exit on ${LINENO}"' EXIT -> wrong linenumber
From: |
Chet Ramey |
Subject: |
Re: trap 'echo "trap exit on ${LINENO}"' EXIT -> wrong linenumber |
Date: |
Sat, 18 Sep 2010 14:18:44 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 |
On 9/18/10 12:57 PM, Eric Blake (cygwin) wrote:
> On 09/17/2010 06:37 PM, Chet Ramey wrote:
>> I guess you could make a case to not reset $LINENO for the exit trap
>> due to this sentence in Posix (though $LINENO is not Posix):
>
> LINENO may be optional in the bare minimum POSIX compliance, but it is
> certainly specified
You're right. I guess the real question is what happens to LINENO
when `eval' is executed. bash, ksh93, and zsh do different things,
and dash doesn't support LINENO at all. Posix says that trap actions
are processed as if executed by eval.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/