Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!ukc!castle!hwcs!zen!frank From: frank@zen.co.uk (Frank Wales) Newsgroups: comp.unix.questions Subject: Re: Why doesn't this work ? Message-ID: <1679@zen.co.uk> Date: 4 Aug 89 10:02:57 GMT References: <443@fdmetd.uucp> <579@lakart.UUCP> <4900@ptsfa.PacBell.COM> Reply-To: frank@zen.UUCP (Frank Wales) Organization: Zengrange Limited, Leeds, England Lines: 17 In article <4900@ptsfa.PacBell.COM> dmt@PacBell.COM (Dave Turner) 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]*\)(.*'` > >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. On Korn shell only, you can also use the form $(command) instead of `command`, which nests and is more readable for complicated command substitutions. -- Frank Wales, Systems Manager, [frank@zen.co.uk<->mcvax!zen.co.uk!frank] Zengrange Ltd., Greenfield Rd., Leeds, ENGLAND, LS9 8DB. (+44) 532 489048 x217