bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cat and -u, unbuffered output support


From: Bob Proulx
Subject: Re: Cat and -u, unbuffered output support
Date: Wed, 25 Jun 2003 22:59:01 -0600
User-agent: Mutt/1.3.28i

Paul Jarc wrote:
> Bob Proulx wrote:
> >    % stty raw
> >    % cat -u > fi
> 
> This may not work; the interactive shell may reset the tty modes after
> each command, so the first stty would bhave no effect.

For shells that do that command line editing such as bash, zsh,
etc. which reset the mode they also save the current stty settings
before going into raw mode for the line edit.  Therefore changing the
mode with stty should be fine.  The shell will read the new mode after
the stty command, or indeed any command, and restore that mode when
executing the next command.  Because of the save and restore the mode
is always ping-ponging back and forth between raw mode and cooked mode
with every command.  It needs to do that otherwise you would never be
able to change the mode with stty.

[Of course older shells such as the V7 Bourne shell do not do any
command line editing and do not reset the modes.]

Bob

P.S. If you want to play with a shell in the old V7 Bourne command
line editing mode you can use bash but turn off the edit modes.

  set +o vi
  set +o emacs

  stty -a

Then note the 'werase' setting (usually ^W), the 'kill' setting
(usually either ^U or ^X), and the 'rprnt' setting (usually ^R).  Now
at this try some line editing.

  echo one two three^W^R^U

If nothing else this will convince you that having a full editor
available is a really useful thing.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]