csh setenv with `cat ...`
Kartik Subbarao
subbarao at phoenix.Princeton.EDU
Sat Apr 27 00:59:26 AEST 1991
In article <56092 at notavax.Princeton.EDU> writes:
>mostek at motcid.UUCP (Frank B. Mostek) wrote:
>>I am having a problem with the csh setenv command:
>>
>>$setenv EXINIT `cat ~/.myexrc`
>>`cat ~/.myexrc`: Ambiguous.
>
>The problem is that `cat ~/.myexrc` produces more than one word. setenv
>takes only two arguments. Do:
>
>setenv EXINIT "`cat ~/.myexrc`"
>
>The double quotes prevent the `...` from being split into words.
>
Unfortunately, this doesn't work in csh (like it does in another
unmentioned shell :-) ).
You can do this, but it depends upon the format of your .exrc:
% setenv EXINIT "`tr -d \\012 < ~/.ex`"
Since you can't quote newlines in csh (apparently).
Your .exrc should not have multiple set statements, because the whole .exrc
has to be slurped in as one line. I don't know about putting comments in
either; they may screw things up.
But anyway, you said that the reason that you used this setenv approach
is because the .exrc got executed twice? Are you sure? I have a .exrc in my
home directory and it never gets executed twice when I vi stuff (e.g, this
~/.article file I'm editing now). You might want to tell us your setup so
that there might be an easier way to do this.
-Kartik
--
internet# rm `df | tail +2 | awk '{ printf "%s/quotas\n",$6}'`
subbarao at phoenix.Princeton.EDU -| Internet
kartik at silvertone.Princeton.EDU (NeXT mail)
SUBBARAO at PUCC.BITNET - Bitnet
More information about the Comp.unix.shell
mailing list