csh and globbing in `..`

Shankar Unni shankar at hpclscu.HP.COM
Fri Mar 11 09:13:54 AEST 1988


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%   YACW (Yet Another Csh Weirdness). %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I'm trying to set a shell variable to contain the output of a command.

For instance,

   set myvar = `grep 'Compile' RESULTS`

This is what happens:

   % ls
   RESULTS bar bletch foo
   % grep 'Compile' RESULTS
   * Compile successful
   % set line = `grep Compile RESULTS`
   % echo $line
   RESULTS bar bletch foo Compile successful

   (!!)

Actually, I sort of understand (I think) what's going on here. The `` globs
the *. OK, OK. Now, how do I disable this globbing?

I've tried:
   % grep .. > /tmp/XXX
   % set line = `cat /tmp/XXX`
with the same results (obviously, as I see now..)

I finally had to do something gross like creating an awk script like
   {print "set line='" $0 "'"}

and try

   grep .. | awk -f awkscript > /tmp/YYY
   source /tmp/YYY

   (AAARGH!!)

Is there an easier (and more elegant) way to do this? I also tried setting
noglob (which was calmly ignored by the ``), so *that*'s not the answer
either..

(Almost makes me want to switch to "ksh" Hahhahhahhehheh..errr..)

ADVthanksANCE,
Shankar.



More information about the Comp.unix.wizards mailing list