Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!udel!burdvax!wrp From: wrp@PRC.Unisys.COM (William R. Pringle) Newsgroups: comp.unix.shell Subject: Re: command substitution Message-ID: <15527@burdvax.PRC.Unisys.COM> Date: 8 Nov 90 05:21:27 GMT References: <5697@alpha.cam.nist.gov> Organization: Unisys Corporation, Paoli Research Center; Paoli, PA Lines: 33 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.$$`` > >Unfortuantly, the second set of Grave accent marks for command >substitution for the basename command will confuse the shell. >Is there a way to "qoute" these so that those grave accent (`) >will be passed down for another layer command substitution? There seems to be a rash of articles about nested backquotes. Since I answered the last one, ... You can use a backslash to quote backward quotes: `basename \`awk '{print $7}' /tmp/process.$$\`` However, since you are already paying the overhead of calling awk, then why not do everything there? `awk '{print substr($7,1,index($7,".log")-1)}' /tmp/process.$$` The index function returns the location of the string ".log" (you could also use strlen($7)-4) and then the substr function prints the portion of the string from the first character up to the character before the ".log" (hence the index()-1) Hope this helps. Bill Pringle