bug-bash
[Top][All Lists]
Advanced

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

Re: Q: Is there a way to tell why DEBUG trap was triggered?


From: Chet Ramey
Subject: Re: Q: Is there a way to tell why DEBUG trap was triggered?
Date: Mon, 16 Mar 2020 13:57:30 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 3/16/20 1:00 PM, Greg Wooledge wrote:
> On Mon, Mar 16, 2020 at 09:47:44AM -0400, Chet Ramey wrote:
>> On 3/15/20 7:41 AM, Šimon Let wrote:
>>> Hi All,
>>>
>>> I'm using PROMPT_COMMAND and DEBUG trap to emulate "PRE" and "POST" hooks
>>> in bash. I have run into the issue where the DEBUG trap gets triggered when
>>> any custom readline widget/function is executed. I would like to
>>> programmatically determine if the DEBUG trap was triggered for a "real"
>>> interactive command or if it was triggered for a custom readline widget.
>> Since the DEBUG trap happens before the command executes, it's not a real
>> `post-command' hook.
> 
> I think they simply stated things backwards.  The DEBUG trap is a
> pre-command hook, and PROMPT_COMMAND is post-command.  Sort of/close
> enough.

Yes, apparently.

> That said, I'm not sure what a "custom readline widget" is.

A binding to a shell function or other program installed with `bind -x'.

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



reply via email to

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