Why doesn't this work ?

Dave Turner dmt at PacBell.COM
Thu Aug 3 02:04:22 AEST 1989


In article <579 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) 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]*\)(.*'`
.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



More information about the Comp.unix.questions mailing list