Gentoo Archives: gentoo-user

From: "»Q«" <boxcars@×××.net>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Shell echo missing after ctrl+c
Date: Mon, 20 Mar 2017 19:49:30
Message-Id: 20170320144851.359d7cb0@sepulchrave.remarqs
In Reply to: [gentoo-user] Re: Shell echo missing after ctrl+c by Ian Zimmerman
On Sun, 19 Mar 2017 22:00:31 -0700
Ian Zimmerman <itz@×××××××.net> wrote:

> On 2017-03-19 22:09, Walter Dnes wrote: > > > If killed with CTRL-C or "kill -9" or "kill -15", it doesn't have a > > chance to restore echoing, and you get the situation you > > described. > > Correct about kill -9, but properly programmed full screen programs > _do_ install signal handlers for SIGTERM (kill -15) and SIGINT (^C) > to avoid this situation. The ncurses library even does that for > programs that link with, IIRC (it has been a while since I've done > any of that stuff). > > One reason why you should consider gentler means before taking a > SIGKILL (kill -9) to a misbehaving program.
I run into this issue most often when I use ctrl+c to stop a bash script. ISTM a 'trap' in the script could be used to restore echo before exit, but my bash-fu isn't strong enough to figure it out.