bug-bash
[Top][All Lists]
Advanced

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

verbosity of DEBUG trap following edit-and-execute-command


From: Ami Fischman
Subject: verbosity of DEBUG trap following edit-and-execute-command
Date: Thu, 2 Apr 2020 09:50:45 -0700

After the editor invoked by edit-and-execute-command exits, the
about-to-be-executed command (as edited by the editor) is echoed, but seemingly
as if [set -v] was set, causing a command executed before the edited command as
the result of a trap DEBUG to be echoed, as well. This is annoying for example
when using the DEBUG trap as a way to change colors as demonstrated in
https://nigeltao.github.io/blog/2018/colorful-text.html#shell-prompts

It would be nicer if the set -v was undone before the trap's handler was
executed so that the printf wasn't shown to the user in the example below.

Repro recipe follows. The initial echo demonstrates that the trap is silent in
the absence of edit-and-execute-command. The second echo command has C-x C-e hit
after the "echo He" is typed, and the line containing printf (third from the
bottom) is what I'm hoping to avoid.

~ $ docker run -it bash:5.0.16
bash-5.0# EDITOR=ed
bash-5.0# trap 'printf "\e[0m"' DEBUG
bash-5.0# echo Hello
Hello
bash-5.0# echo He
"/tmp/bash-fc.INbEkF", 1 lines, 8 chars
: 1s/He/Hello/
: w
"/tmp/bash-fc.INbEkF", 1 lines, 11 chars
: q
echo Hello
printf "\e[0m"
Hello
bash-5.0#

Note this also repros in 5.0.11(1) as well as 3.2.57(1).

Cheers,
-a



reply via email to

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