bug-bash
[Top][All Lists]
Advanced

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

Re: RFC: Enabling or disabling tracing shell functions


From: Dan Douglas
Subject: Re: RFC: Enabling or disabling tracing shell functions
Date: Sun, 5 Jun 2016 23:50:09 -0500

On Sun, Jun 5, 2016 at 8:48 PM, Chet Ramey <chet.ramey@case.edu> wrote:
> "Traced functions inherit the DEBUG  and  RETURN  traps  from  the  calling
> shell."

Why did RETURN originally get sucked into set -T? Was it supposed to
be primarily for debugging? Some functions actually use it for
internal purposes and enabling -T to debug causes (probably unwanted)
side-effects in such cases since there's no way to control their
inheritance separately.

If the goal is to inspect values when a function returns that can be
accomplished with just a DEBUG trap:
trap 'if [[ $LASTFUNC != ${FUNCNAME[0]} ]]; then ...;
LASTFUNC=${FUNCNAME[0]}; fi' DEBUG



reply via email to

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