bug-bash
[Top][All Lists]
Advanced

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

[PATCH] consistent BASH_COMMAND, DEBUG trap, xtrace order


From: Grisha Levit
Subject: [PATCH] consistent BASH_COMMAND, DEBUG trap, xtrace order
Date: Fri, 25 Aug 2023 22:40:41 -0400

There is some inconsistency betweeen various command types in the order of
(1) setting the value used for BASH_COMMAND (2) running the DEBUG trap and
checking its return value and (3) printing the PS4 string.

While simple, arithmetic, and conditional commands follow the order above,
`for', `select' and `case' do not.

For example, when executing a `for' command, BASH_COMMAND is only updated
after PS4 has been printed:

PS4=$'+ $BASH_COMMAND\t'
set -x
for ((i=0; i<1; i++)) { : i=$i; }

+ set -x (( i=0 ))
+ ((i=0)) (( i<1 ))
+ : i=$i : i=0
+ : i=$i (( i++ ))
+ ((i++)) (( i<1 ))

Attachment: 0001-consistent-BASH_COMMAND-DEBUG-trap-xtrace-order.patch
Description: Text Data


reply via email to

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