DASH Shell discussions
 help / color / mirror / Atom feed
From: Sebastien Peterson-Boudreau <sebastien.peterson.boudreau@gmail.com>
To: dash@vger.kernel.org
Subject: Re: stty -echo doesn't work?
Date: Thu, 23 Apr 2026 18:36:56 -0300	[thread overview]
Message-ID: <aeqQ-ExEzduLIW3W@HQ> (raw)
In-Reply-To: <b7d62511-4a17-427e-ab7b-468f9896e6de@gigawatt.nl>

> stty is not a shell built-in command and dash has no control over what it
> does.

I knew that, but this was still a behaviour I was only seeing in dash
and not other shells.

> Running this locally, what seems to be happening is that the command
> did work, but when dash is using libedit for command editing, it immediately
> gets reset when prompting for the next command.

I really should have done more thorough testing... You're right; I see
that echo is disabled when I try

	$ stty -echo; cat > foo

For the duration of cat(1) (IOW, until I hit ^D), the terminal does not
echo, but upon returning to the shell echo is restored.

> What behaviour are you expecting here? Are you expecting echo to still be
> turned off when entering the next command, or to be turned off again after
> the next command has been entered successfully? Both options, as well as
> dash/libedit's current behaviour, seem reasonable at first glance to me.

Assuming I am understanding the two options you list, I think what I
expected was the second? For bash, the user input is not echoed until
echo is restored with `stty echo', but the prompt is still printed
after each command is entered. To make myself extremely clear (not
because I don't think you're capable of understanding, but because I
don't think I'm capable of explaining...), I will do a lil diagram thing

	$ echo hi
	hi
	$ stty -echo
	$            # user types `echo not echoed', but it is not shown
	not echoed
	$            # user types `stty echo', but it is not shown
	$ echo hi again
	hi again

now that is what I _expected_ to happen, but that is based on bash's
behaviour, which is based on readline (what bash uses (I think?)). What
do I think _should_ happen? Well now I feel like I might need to do
some more research. Maybe this is a situation where bash does something
weird but we're all used to it.

Thanks for your detailed reply!
-- 
S.

  reply	other threads:[~2026-04-23 21:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23  2:39 stty -echo doesn't work? Sebastien Peterson-Boudreau
2026-04-23  7:05 ` Harald van Dijk
2026-04-23 21:36   ` Sebastien Peterson-Boudreau [this message]
2026-04-24  0:17     ` Chet Ramey
2026-04-24  3:25       ` Sebastien Peterson-Boudreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aeqQ-ExEzduLIW3W@HQ \
    --to=sebastien.peterson.boudreau@gmail.com \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox