On 3/19/22 1:07 PM, Taqras via Bug reports for the GNU Bourne Again SHell wrote:

Bash Version: 5.1
Patch Level: 16
Release Status: release

Description:
     PS0:
       The value of this parameter is expanded like PS1 and displayed by
       interactive shells after reading a command and before the command is
       executed.
     BASH_COMMAND:
       The command currently being executed or about to be executed, unless
       the shell is executing a command as the result of a trap, in which
       case it is the command executing at the time of the trap. If
       BASH_COMMAND is unset, it loses its special properties,
       even if it is subsequently reset.
     PROBLEM:
       By the time PS0 is displayed, BASH_COMMAND is still set to the
       previous command, not the command about to be executed.

These two events take place at different points in command processing. PS0
is displayed immediately after the shell reads a command. BASH_COMMAND is
set after assignment statements and redirections are processed as part of
command execution. You can't reconcile these two things.

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

Reply via email to