bug-bash
[Top][All Lists]
Advanced

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

Re: [bug] PROMPT_COMMAND is not executed as expected in some situations


From: Chet Ramey
Subject: Re: [bug] PROMPT_COMMAND is not executed as expected in some situations
Date: Wed, 15 Apr 2020 17:35:21 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 4/15/20 2:59 PM, Franklin, Jason wrote:

> Bash Version: 5.0
> Patch Level: 16
> Release Status: release
> 
> Description:
> 
> I have discovered that PROMPT_COMMAND is not executed before the
> printing of PS1 in the following three situations:

PROMPT_COMMAND is printed before PS1 when the shell goes to read a command.
(When you're using readline, readline prints the prompt initially, but
PROMPT_COMMAND works whether you're using editing or not.) That isn't true
in any of these cases.

> 
> (1) <C-x><C-e> is used
> (2) histverify is set
> (3) completion suggestions are shown

In cases 1 and 3, that all takes place within a single call to readline(),
even before the shell receives and tries to parse any of the line.

In the case of histverify, it's just about the same thing, technically
after the readline() call returns but before the shell parser gets the
line -- it's logically the same call.

These all pretty much all fall into the category of the editor reprinting
the prompt before it returns.

-- 
``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]