Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!egsner!texrex!rmfowler From: rmfowler@texrex.uucp (Rex Fowler) Newsgroups: comp.sys.3b1 Subject: Re: stty: : Not a typewriter Summary: How-to-fixit Keywords: vi, ksh, Message-ID: <1991Mar8.044841.11005@texrex.uucp> Date: 8 Mar 91 04:48:41 GMT References: <1495@das13.snide.com> <1496@das13.snide.com> <1991Mar7.130721.4475@dms3b1.uucp> Reply-To: rmfowler%texrex@cirr.com Organization: texrex - Personal 3b1 System - Dallas, TX Lines: 68 In article <1991Mar7.130721.4475@dms3b1.uucp> dave@dms3b1.UUCP (Dave Hanna) writes: >In article <1496@das13.snide.com> dave@das13.snide.com (Dave Snyder) writes: >>= For example: when in vi, I like to read in the current date & time by typing >>= "!!date". What that does is fork a shell, run date and the output of date is >>= read into the buffer (see example below). >>= >>= Wed Mar 6 07:31:23 EST 1991 > >>= Now for some strange reason, this is what I get when I type "!!date". > >>= stty: : Not a typewriter >>= Wed Mar 6 07:38:47 EST 1991 > >I've bumped into the same problem. It seems to come from the 'stty' >statement in your .kshrc, which, I assume, is run everytime a new >ksh is started. Apparently, the ksh is started with stdin being >redirected somehow to come from the editor buffer, and so stty doesn't >like it. > >I've gotten rid of it by adding "shell=/bin/sh" to my EXINIT environment >variable. That causes sh instead of ksh to be used for any "!" actions. >However, I'm not really satisfied with that solution, because sh doesn't >understand "~/" notation, so I have to use $HOME (e.g., ":r $HOME/.signature") >which is annoying. > Yuck... And doesn't your mailer or poster add your .signature for you anyway? >I'd be real interested if anybody has a better analysis and/or solution. > >>David A. Snyder @ Snide Inc. - Folcroft, PA > > >-- >Dave Hanna, Infotouch Systems, Inc. | "Do or do not -- There is no try" >P.O. Box 584, Bedford, TX 76095 | - Yoda >(214) 358-4534 (817) 540-1524 | >UUCP: ...!letni!dms3b1!dave | The easy answer is: :r !date instead of !!date The right answer is: No matter which shell you are using ksh/csh/sh, you should only execute certain commands when you are starting an interactive shell. In .kshrc you can do: ---------------------------------------------------------------- if [ -t 0 ] then stty quit intr kill erase  -noflsh ixon ixoff any_other_commands_that_are_necessary_only_for_interactive_shells fi ---------------------------------------------------------------- No manual handy, but i believe this tests to see if the shell is connected to a tty. I grabbed this off a recent discussion in comp.unix.shell. Some claimed it worked, some claimed it didn't. It works for me. There are similar commands for other shells. I believe there was a more correct way posted for ksh but I just went back to check and it must've already expired. -- Rex Fowler UUCP: egsner!texrex!rmfowler