bang problems in vi

Gary S. Trujillo gst at gnosys.svle.ma.us
Sat Jul 21 08:58:28 AEST 1990


In article <1990Jul20.032240.29834 at cbnewsj.att.com>
	avr at 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 at 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 at gnosys.svle.ma.us
Somerville, Massachusetts                     {wjh12,spdcc,ima,cdp}!gnosys!gst



More information about the Comp.sys.att mailing list