Xref: utzoo comp.sys.att:10043 unix-pc.general:5807 Path: utzoo!utgpu!watserv1!watmath!att!cbnewsj!avr From: avr@cbnewsj.att.com (adam.v.reed) Newsgroups: comp.sys.att,unix-pc.general Subject: Re: bang problems in vi Summary: "$-" contains current flags. RTFM. Message-ID: <1990Jul22.031419.6965@cbnewsj.att.com> Date: 22 Jul 90 03:14:19 GMT References: <37112@shemp.CS.UCLA.EDU> <1990Jul20.032240.29834@cbnewsj.att.com> <756@gnosys.svle.ma.us> Followup-To: unix-pc.general Organization: AT&T Bell Laboratories Lines: 39 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