[Top][All Lists]

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

Re: trap 'echo "trap exit on ${LINENO}"' EXIT -> wrong linenumber

From: Eric Blake (cygwin)
Subject: Re: trap 'echo "trap exit on ${LINENO}"' EXIT -> wrong linenumber
Date: Sat, 18 Sep 2010 10:57:27 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100907 Fedora/3.1.3-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.3

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, and I see no reason why bash should not fully comply with the User Portability Utilities option (which also includes things like fc, that bash also supports):

Set by the shell to a decimal number representing the current sequential line number (numbered starting with 1) within a script or function before it executes each command. If the user unsets or resets LINENO , the variable may lose its special meaning for the life of the shell. If the shell is not currently executing a script or function, the value of LINENO is unspecified. This volume of POSIX.1-2008 specifies the effects of the variable only for systems supporting the User Portability Utilities option.

Eric Blake
volunteer cygwin package maintainer

To unsubscribe to the cygwin-announce mailing list, look at the
"List-Unsubscribe: " tag in the email header of this message.  Send email
to the address specified there.  It will be in the format:


If you need more information on unsubscribing, start reading here:


Please read *all* of the information on unsubscribing that is available
starting at this URL.

reply via email to

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