command substitution
Tom Christiansen
tchrist at convex.COM
Thu Nov 8 15:11:54 AEST 1990
In article <5697 at alpha.cam.nist.gov> coleman at cam.nist.gov (Sean Sheridan Coleman X5672) writes:
>I really want to do the following:
>
>set date = `basename `awk '{print $7}' /tmp/process.$$``
I'm sure I just saw something like this. If you were using ksh, you could
simply say:
date=$(basename $(awk '{print $7}' /tmp/process.$$))
and be done with it, but for the csh, you're going to have to go through
more convolutions to achieve the same effect.
You have to do it in two manual stages;
set widget = `awk '{print $7}' /tmp/process.$$`
set date = `basename $widget`
should work. I found that quoting the widget string was enough,
so I think this will work for you:
set widget = '`awk '"'"'{print $7}'"'"' /tmp/process.$$`'
set date = `basename $widget`
because this worked for me:
set cmd = '`whoami`'
echo i am `id $cmd`
which came as a bit of a surprise. You can do the same thing in /bin/sh, too:
cmd='`whoami`'
echo i am `id $cmd`
--tom
More information about the Comp.unix.shell
mailing list