vi and "set prompt" question
chris at umcp-cs.UUCP
chris at umcp-cs.UUCP
Mon Apr 23 10:31:03 AEST 1984
If you "set prompt" in your .cshrc without carefully first checking
whether "prompt" was already set, then the C shell will cheerfully
print prompts into the pipe vi uses to expand glob characters. If
you say ":e abc*", vi opens a pipe to the C-shell and writes the
command "echo abc*" down the pipe, then reads the response. If the
response contains spaces or newlines, vi gets confused. If you set
your prompt in your .cshrc, vi tends to get "(1) abc.file (2)" back
from the C-shell, instead of just "abc.file".
The solution is to kludge your .cshrc like this:
if ($?prompt) then
# things to do for an interactive shell, like:
set prompt='(\!) '
endif
This works because a non-interactive shell doesn't have a prompt
set, while an interactive shell has it set to "% ".
If you have a large .cshrc, this can speed things up quite a bit
when programs run other programs with "csh -c 'command'", if you
put all of it inside that test.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at maryland
More information about the Comp.unix.wizards
mailing list