Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16077
| From | Ami Fischman <ami@fischman.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | verbosity of DEBUG trap following edit-and-execute-command |
| Date | 2020-04-02 09:50 -0700 |
| Message-ID | <mailman.20.1585849035.2644.bug-bash@gnu.org> (permalink) |
| References | <CAGKqTXWmNgoG5yGFrz3ysORDarQZi8ZsKqNS+QDkpuhM6EARNQ@mail.gmail.com> |
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
Back to gnu.bash.bug | Previous | Next — Next in thread | Find similar
verbosity of DEBUG trap following edit-and-execute-command Ami Fischman <ami@fischman.org> - 2020-04-02 09:50 -0700 Re: verbosity of DEBUG trap following edit-and-execute-command ami@fischman.org - 2020-05-01 22:40 -0700
csiph-web