Why doesn't this work ?

David Goodenough dg at lakart.UUCP
Sat Jun 17 00:41:57 AEST 1989


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]*\)(.*'`
> 
> The shell does not feed the whole argument list to 'expr(1)', so I get
> the following error message:
> 
> 	sh:   : 'uid=\([0-9]*\)(.*': execute permission denied

Possibly because `` constructs don't nest, at least not any way I've tried.

Try this:

STUG=`id`
USERID=`expr "$STUG" : 'uid=\([0-9]*\)(.*'`
-- 
	dg at lakart.UUCP - David Goodenough		+---+
						IHS	| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp at xait.xerox.com		  	  +---+



More information about the Comp.unix.questions mailing list