dave@das13.snide.com (Dave Snyder) (03/06/91)
That's the error message I get while doing various things on my machine. 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 Anyone have any ideas? DAS -- David A. Snyder @ Snide Inc. - Folcroft, PA UUCP: ..!uunet!das13!dave INTERNET: dave@das13.snide.com
dave@das13.snide.com (Dave Snyder) (03/07/91)
In article <1495@das13.snide.com>, dave@das13.snide.com (Dave Snyder) writes:
= That's the error message I get while doing various things on my machine.
=
= 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
=
=
= Anyone have any ideas?
=
I know, you're not supposed to follow-up your own articles... but I do have
more information... This error is really system error 25 and it only shows
up when the login shell is /bin/ksh instead of /bin/sh. Is this weird?
Please, ideas anyone?
DAS
--
David A. Snyder @ Snide Inc. - Folcroft, PA
UUCP: ..!uunet!das13!dave INTERNET: dave@das13.snide.com
dave@dms3b1.uucp (Dave Hanna) (03/07/91)
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 know, you're not supposed to follow-up your own articles... but I do have >more information... This error is really system error 25 and it only shows >up when the login shell is /bin/ksh instead of /bin/sh. Is this weird? 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. 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 |
dave@das13.snide.com (Dave Snyder) (03/08/91)
I just want to say thank you to everyone that responded to my article. It's amazing... everyone diagnosed the problem the same way and sure enough, I did have an "stty" in my .kshrc file. Now that that's been solved, does anyone have any ideas why bounced mail from my system has the "Not a typewriter" message in the "Transcript" portion where the reason for the bounce is. Thanks, DAS -- David A. Snyder @ Snide Inc. - Folcroft, PA UUCP: ..!uunet!das13!dave INTERNET: dave@das13.snide.com
dnichols@ceilidh.beartrack.com (DoN Nichols) (03/08/91)
In article <1495@das13.snide.com> dave@das13.snide.com (Dave Snyder) writes: >That's the error message I get while doing various things on my machine. > >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 Have you made any changes recently to your '.kshrc' (if using /bin/ksh) or '.profile'? Especially the '.kshrc'. If I remember correctly, the '.profile' is sourced only at logon, while the '.kshrc' is sourced whenever a subshell is started, such as for running a command while in your editor. What appears to be happening is that your '.kshrc' is trying to set some terminal options whenever you start a new shell, (the kill char, etc), and stty looks at standard output, determines it is a pipe (to your buffer in vi), and it can't do ioctl's on a pipe which are intended for a tty, therefore the 'not a typewriter' error message. The stty operations are better done in your '.profile'. Maybe you can get away with redirecting it to /dev/tty, but I wouldn't bet on it. Good Luck DoN. -- Donald Nichols (DoN.) | Voice (Days): (703) 664-1585 D&D Data | Voice (Eves): (703) 938-4564 Disclaimer: from here - None | Email: <dnichols@ceilidh.beartrack.com> --- Black Holes are where God is dividing by zero ---
rmfowler@texrex.uucp (Rex Fowler) (03/08/91)
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 <rmfowler%texrex@cirr.com> UUCP: egsner!texrex!rmfowler
lied@cbnewsc.att.com (Bob Lied) (03/08/91)
In answer to the question of how to avoid interactive stuff in a ksh $ENV file, especially for things like editor escapes, there are two common solutions that I know of: 1. The $- variable lists the flags that are set by ksh. If ksh is invoked interactively (which I believe translates to input and output are ttys), then the -i flag is set. So, one way to avoid things that write to the terminal for non-interactive use is something like this inside the $ENV file: case "$-" in *i*) # stty, reset prompts, alias cd, etc ;; *) # functions and aliases that always export esac 2. To avoid having the $ENV file sourced at all, there is a trick that comes from page 78 of "The Kornshell Command and Programming "Language". Instead of setting ENV directly, you set a secondary variable and use a side effect of evaluation (ENV is always re-evaluated at shell startup). So, in the .profile, you set up something like: export ENVFILE=~/.kshrc export ENV='${ENVFILE[(_$-=0)+(_=1)-_${-%%*i*}]}' Note that the last part of this is the same as above: checking $- to see if the -i flag is set. The rest of the gobbledygood evaluates to 0 or 1; if it's zero, ENV == ENVFILE, but if it's one, ENV=''. No one said it had to be obvious. Bob Lied att!ihlpf!lied
ward@tsnews.Convergent.COM (Ward Griffiths) (03/09/91)
rmfowler@texrex.uucp (Rex Fowler) writes: >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: >>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? Believe it or not, neither the AT&T /bin/mail or the BSD /usr/ucb/mail (known as mailx on many AT&T systems will append a signature to a message automatically. It's only when you get involved with the fancier mailers that this feature becomes available. Most posting and newsreading software presently in use does this also. But the older mail programs are really quite primitive things, and the mail program provided with the Unix PC is more primitive than that I first used with Version 7 Tandy Xenix. -- Ward Griffiths, Unisys NCG aka Convergent Technologies The people that make Unisys' official opinions get paid more. A LOT more. =========================================================================== To Hell with "Only One Earth"! Try "At Least One Solar System"! If I say love, I'll sound sentimental, and if I say sex, I'll sound cynical. I'll call it pair bonding and sound scientific. The Golden Apple
donlash@uncle.uucp (Donald Lashomb) (03/12/91)
In article <1495@das13.snide.com> dave@das13.snide.com (Dave Snyder) writes: >That's the error message I get while doing various things on my machine. > [...] >stty: : Not a typewriter [...] >Anyone have any ideas? Are you using ksh? If so, check your ENV file ($HOME/.kshrc) for the stty command. Whenever ksh starts up, it reads and executes its ENV file. Many people put stty and other like commands in there. However when ksh is run unconnected to a tty, these commands fail with the error message you see. The answer to this problem is to isolate the stty command in ENV by testing ksh's "$-" variable. eg: case $- in *i*) # interactive ksh stty sane ;; esac Hope this helps, Don donlash@uncle.UUCP
ebd@fang.ATT.COM (Elliot B Dierksen) (03/13/91)
From article <1495@das13.snide.com>, by dave@das13.snide.com (Dave Snyder): > That's the error message I get while doing various things on my machine. > > 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 > > Anyone have any ideas? I have a solution that I got from Don Lashcomb (donlash@uncle.UUCP) because it also happened with his enhanced cron. In your .kshrc ($ENV) case "$-" in *i*) stty splot ;; # only runs stty when in interactive mode esac I already mailed that to Dave, but I thought it might be of interest to the net in general. Hope that helps, EBD -- Elliot Dierksen "It's such a fine line between clever and stupid." -- "This is Spinal Tap" Work) ebd@fang.att.com (407) 660-3377 Home) elliot@alfred.UUCP (407) 290-9744
dwn@swbatl.sbc.com (David Neill-OKCy Mktg 405-278-4007) (03/13/91)
In article <1991Mar12.171653.1645@fang.ATT.COM> ebd@fang.ATT.COM (Elliot B Dierksen) writes: > >I have a solution that I got from Don Lashcomb (donlash@uncle.UUCP) because >it also happened with his enhanced cron. > >case "$-" in >*i*) stty splot ;; # only runs stty when in interactive mode >esac > >I already mailed that to Dave, but I thought it might be of interest to the >net in general. > A quick, dumb question that probably belongs in comp.unix.shell, where does the interactive (-i) flag get set? Does ksh set the flag after verifying whether or not it is interactive, or could this flag be mistakenly invoked from a script? -- name & address (this account) -> dwn@swbatl.sbc.com David Neill office -> 405-291-1990 -> ..texbell!oktext!mktco Mgr - Mktg.(SWBTCo) home -> 405-843-4464 -> ..texbell!oktext!frodo!david