From: Chet Ramey
Subject: Re: Commentary on: Bash Command Leads to ...
Date: Mon, 2 Feb 2026 09:22:50 -0500
>> Given that, I would like to point out that tcsh, to its credit, always
>> resets
>> the terminal
>> to "sane" before prompting for user input. This is a Good Thing and
>> something
>> that
>> (IMNSHO), bash should also do.
>Bash saves the tty state before each foreground command, and restores the
>saved tty settings if the command stops or terminates due to a signal.
>Otherwise, the shell has to provide a builtin that mimics some or all of
>`stty'.
I'm never quite sure what your posts mean, since you are, shall we
say, (more than) a bit laconic.
But for whatever it is worth, it is true that from time to time, I
find myself in bash having to blind-type "stty sane^j" because some
program has crashed out without fixing the terminal modes. This never
happens in tcsh.
I can't say for sure when/how this happens, but it does. In fact,
there is a program that I wrote (a long time ago) (and still use
today) that puts the terminal into no-echo mode and, of course, resets
the mode on a normal exit, but if it crashes out (which can happen),
sometimes, in bash, it leaves the echo off. I think when I wrote it,
two things were true:
1) I was trying to keep it as simple as possible, so did not
include the necessary signal handlers to ensure that the terminal
modes are always reset.
and
2) I was using tcsh at the time and since it handled it, I didn't
bother with the previous point.
>The OP's function defeats that.
I'm sure that is true.
=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.
When responding to my posts, please try to refrain from giving bureaucratic
answers.
If you have nothing useful to say, then just click Next and go on.