Path: utzoo!attcan!uunet!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.shell Subject: Re: command substitution Message-ID: <108388@convex.convex.com> Date: 8 Nov 90 04:11:54 GMT References: <5697@alpha.cam.nist.gov> Sender: usenet@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 35 In article <5697@alpha.cam.nist.gov> coleman@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