Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!pacbell!ptsfa!dmt From: dmt@PacBell.COM (Dave Turner) Newsgroups: comp.unix.questions Subject: Re: Why doesn't this work ? Message-ID: <4900@ptsfa.PacBell.COM> Date: 2 Aug 89 16:04:22 GMT References: <443@fdmetd.uucp> <579@lakart.UUCP> Reply-To: dmt@PacBell.COM (Dave Turner) Organization: Pacific * Bell, San Ramon, CA Lines: 21 In article <579@lakart.UUCP> dg@lakart.UUCP (David Goodenough) writes: .jon@fdmetd.uucp (Jon Ivar Tr|stheim) sez: .> Why does not the following command work in a Bourne shell script ? .> .> USERID=`expr "`id`" : 'uid=\([0-9]*\)(.*'` .Possibly because `` constructs don't nest, at least not any way I've tried. . .Try this: . .STUG=`id` .USERID=`expr "$STUG" : 'uid=\([0-9]*\)(.*'` Or escape the inner backquotes: USERID=`expr "\`id\`" : 'uid=\([0-9]*\)(.*'` This works on the Bourne and Korn shells using System V R2.1 on a 3B20. -- Dave Turner 415/542-1299 {att,bellcore,sun,ames,decwrl}!pacbell!dmt