Why doesn't this work ?

Frank Wales frank at zen.co.uk
Fri Aug 4 20:02:57 AEST 1989


In article <4900 at ptsfa.PacBell.COM> dmt at PacBell.COM (Dave Turner) writes:
>jon at 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 at zen.co.uk<->mcvax!zen.co.uk!frank]
Zengrange Ltd., Greenfield Rd., Leeds, ENGLAND, LS9 8DB. (+44) 532 489048 x217 



More information about the Comp.unix.questions mailing list