[comp.sys.att] bang problems in vi

avr@cbnewsj.att.com (adam.v.reed) (07/20/90)

In article <37112@shemp.CS.UCLA.EDU>, kirkaas@oahu.cs.ucla.edu (paul kirkaas) writes:
> Whenever I do a bang substitution within vi (eg, !!ls)
> on my 3b1, I get the appropriate substitution, with the following error
> message prepended to the text:
> stty: : Not a typewriter
> What's going on & how do I get rid of it?

Most likely, you are using ksh and do an stty, directly or indirectly,
in your $ENV, which is carried out whenever !! invokes ksh. To fix,
use something like the following in your $ENV:

case $- in *s* | *i* )
	# your interactive stuff, stty etc., goes here
;;
esac

				Adam_V_Reed@ATT.com

tneff@bfmny0.BFM.COM (Tom Neff) (07/20/90)

In article <1990Jul20.032240.29834@cbnewsj.att.com> avr@cbnewsj.att.com (adam.v.reed) writes:
>In article <37112@shemp.CS.UCLA.EDU>, kirkaas@oahu.cs.ucla.edu (paul kirkaas) writes:
>> stty: : Not a typewriter
>
>Most likely, you are using ksh and do an stty, directly or indirectly,
>in your $ENV, which is carried out whenever !! invokes ksh. To fix,
>use something like the following in your $ENV:
>
>case $- in *s* | *i* )
>	# your interactive stuff, stty etc., goes here
>;;
>esac
>


Or you can employ my favorite bit of horrendousness in your .profile:

	export Envfile=$HOME/.env
	export ENV='${Envfile[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'

(I have been accused of using Korn shell as an apl interpreter :-) )


-- 
When considering "victim's rights," remember  || vv  Tom Neff
that an innocent defendant is also a victim.  ^^ ||  tneff@bfmny0.BFM.COM

gst@gnosys.svle.ma.us (Gary S. Trujillo) (07/21/90)

In article <1990Jul20.032240.29834@cbnewsj.att.com>
	avr@cbnewsj.att.com (adam.v.reed) writes

(in connection with running interactive stuff only when standard input
 is coming from a tty):

> case $- in *s* | *i* )
> 	# your interactive stuff, stty etc., goes here
> ;;
> esac
> 
> 				Adam_V_Reed@ATT.com

Can you explain what's going on here?  Looks as if the arg string sent
to the forked ksh contains a "s" or an "i" if the shell is interactive.
Why is that?

My solution comes from something posted a couple of years ago.

In your .profile, stick the lines:

	START=~/.kshrc

	ENV='${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'

Then you put commands in your .kshrc that you want to have executed
iff the shell is running interactively.  (Please don't ask me what
the "ENV=..." command means, but I can dig it up from the original
message if enough folks really want to know.  I think the idea is
that the ENV environment variable, which tells ksh where to read
commands from when it starts up, either gets set to ~/.kshrc or to
the null string, depending on some stuff that determines whether
the shell is running interactively or not.)

-- 
Gary S. Trujillo                              gst@gnosys.svle.ma.us
Somerville, Massachusetts                     {wjh12,spdcc,ima,cdp}!gnosys!gst

donlash@uncle.uucp (Donald Lashomb) (07/21/90)

In article <37112@shemp.CS.UCLA.EDU> kirkaas@oahu.cs.ucla.edu (paul kirkaas) writes:
=Whenever I do a bang substitution within vi (eg, !!ls)
=on my 3b1, I get the appropriate substitution, with the following error
=message prepended to the text:
=
=stty: : Not a typewriter
=
=What's going on & how do I get rid of it?
=
=I hesitate to ask such a trivial question on the net, but
=this has been going on for three years now, and I'm tired of it.
=Thanks.
=--
=Paul Kirkaas
=kirkaas@cs.ucla.edu


Are you using ksh?  If so, try looking in your
ENV file ($HOME/.kshrc usually) for a stty command.
Try moving the offending stty command to .profile

hope this helps,
-Don		donlash@uncle.UUCP

avr@cbnewsj.att.com (adam.v.reed) (07/22/90)

In article <756@gnosys.svle.ma.us>, gst@gnosys.svle.ma.us (Gary S. Trujillo) writes:
> In article <1990Jul20.032240.29834@cbnewsj.att.com>
> 	avr@cbnewsj.att.com (adam.v.reed) writes
> 
> (in connection with running interactive stuff only when standard input
>  is coming from a tty):
> 
> > case $- in *s* | *i* )
> > 	# your interactive stuff, stty etc., goes here
> > ;;
> > esac
> > 
> > 				Adam_V_Reed@ATT.com
> 
> Can you explain what's going on here?  Looks as if the arg string sent
> to the forked ksh contains a "s" or an "i" if the shell is interactive.
> Why is that?

RTFM. "$-" contains the current flags, not the arg string.
And if the shell is interactive, the s flag or the i flag (or both)
must be set.

> My solution comes from something posted a couple of years ago.
> In your .profile, stick the lines:
> 	START=~/.kshrc
> 	ENV='${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'
> Then you put commands in your .kshrc that you want to have executed
> iff the shell is running interactively.  (Please don't ask me what
> the "ENV=..." command means, but I can dig it up from the original
> message if enough folks really want to know.  I think the idea is
> that the ENV environment variable, which tells ksh where to read
> commands from when it starts up, either gets set to ~/.kshrc or to
> the null string, depending on some stuff that determines whether
> the shell is running interactively or not.)

Apart from being illegible, your "solution" is weak: if any
of your aliases define useful filters, you may wish to use them from
within vi. I can do that. Can you?
					Adam_V_Reed@ATT.com