stty echo in ash

Rich Felker dalias at aerifal.cx
Thu Jul 27 01:11:36 UTC 2006


On Wed, Jul 26, 2006 at 03:54:21PM -0700, David Byron wrote:
> I'm trying to turn echo off but I'm having trouble.
> 
> I'm running ash both via direct serial connect and telnetd.  I get the same
> behavior both ways.
> 
> The output of stty before I mess with anything is:
> 
> # stty
> speed 115200 baud;
> -brkint ixoff -imaxbel
> 
> and whatever I type shows up in the shell.
> 
> As well I have a C program that reads from stdin and the characters I type
> are echoed there.
> 
> When I run
> 
> # stty -echo
> 
> I still see the characters I type echoed in ash.  This doesn't seem right to
> me.  Do you agree?
> 
> In my C program, the characters I type don't echo anymore after running stty
> -echo.
> 
> I see this under both 1.1.3 and 1.2.0.
> 
> Thanks for your help.

The settings chosen by stty will not affect an interactive shell,
since it must replace them with appropriate interactive settings for
reading input (at least if line editing is enabled). Whenever you run
a command, the user-set stty settings are restored, and if the command
changes them, they're saved again before the shell prompt appears and
puts the terminal back into interactive mode.

BTW, assuming you have line editing enabled, echo is not being
enabled. Rather, the code in cmdedit.c is displaying the character it
received.

Is there a reason you expect or need it to work differently?

Rich




More information about the busybox mailing list