Which is more portable: stty < or stty >

Guy Harris guy at auspex.auspex.com
Wed Mar 14 05:22:38 AEST 1990


>The former is the 7th Ed. UNIX and 4BSD behavior.
>System V assumes you may want to redirect the output somewhere other
>than the terminal being probed.

You can do that with the V7 and BSD one, it's just more painful - you
have to redirect the standard error.

The S5 behavior is a bit more natural, in that its output goes to, well,
the standard output; the only reason I can see for the V7 behavior is
that it makes it possible to set the modes on a tty other than one on
which you're logged in without being super-user, since traditionally
ttys have been publicly writable but not publicly readable.

While in some environments this would be considered a feature ("Hey,
Jane, I screwed up my tty settings; could you fix them for me? I'm on
'/dev/tty73'."), it would be considered a problem in others
("stty erase 's' kill 't' intr 'y' >/dev/tty73").

Given that in 4.3BSD and now S5R4 ttys are *not* publicly writeable, but
writeable only by a special group, to which programs like "write" are
set-GID (so that you can't send things like the "transmit screen to
host" escape sequence to somebody else's terminal), the V7 behavior
doesn't buy you anything any more.



More information about the Comp.unix.wizards mailing list