vi bug(feature?)

William P. Malloy malloy at ittral.UUCP
Wed Jul 31 02:15:51 AEST 1985


> From: mike at peregrine.UUCP (Mike Wexler)
> 
> My standard shell is the /bin/csh.  When I try doing a any command
> with a name that needs to be shell expanded the editor calls the shell,
> but gets confused by the shell prompt and includes that in the file list.
> This is a pain when using the n command, but makes things like e ~/.signature
> impossible(at lease I don't no how to make it work.).
> I do not have source code.  I am running on a SUN 2/120 under Unix 4.2BSD(Sun
> release 2.00).

Your problem is with C Shell and not with vi.  The problem comes due to the
interaction of resetting shell variables in non-interactive shells.  I run into
this here every couple of months when someone plays with their .cshrc file.
See the reminder I wrote to myself (below) in my .cshrc file [I kept forget-
ting about it].  What it means is make sure ALL set's are done inside such an
``if (?prompt) then set var=value endif'' structure and you'll be safe.
#
# The reason for setting a prompt only if a prompt already exists.
#
# If it sets a prompt in a non-interactive shell, for instance vi(1)
# firing up a sub-shell to expand shell meta-characters, the set prompt
# will stomp on alot of shell variables used for the expansion (like ~)
#
if ( $?prompt ) then
   set history=500
   set mail=/usr/spool/mail/malloy
   set prompt="`hostname`:$cwd> "
   set histchars=",;"
   set cdpath=(~ ~/work /usr/src/local)
   set path=(. /usr/new /usr/new/mh ~/mybin ~/mycmd /usr/local/staff $path)
endif
-- 
Address: William P. Malloy, ITT Telecom, B & CC Engineering Group, Raleigh NC
         {ihnp4!mcnc, burl, ncsu, decvax!ittvax}!ittral!malloy



More information about the Comp.bugs.4bsd.ucb-fixes mailing list