[Stray prompts can cause trouble for many commands that start a noninteractive shell. This problem may have been fixed in your C shell. The point Chris makes about speeding up your .cshrc still applies, though. -JP]
If you set prompt in your
.cshrc file
without carefully checking first whether or not
prompt was already set (2.9),
many versions of the C shell will cheerfully
print prompts into the pipe vi uses to expand glob characters
[
filename wildcards (*
, ?
, []
) (1.16)
and the
tilde (~
) (14.11)
-JP ].
When you type :r 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 to (
n
)
in your
.cshrc [i.e., if you show the history number in parentheses as
the prompt-TOR ], 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 (2.9) like this:
if $?prompt | if ($?prompt) then # things to do for an interactive shell, like: set prompt='(\!) ' endif |
---|
This works because a noninteractive shell has no initial prompt,
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 net.unix-wizards on Usenet, 22 April 1984