Retrieving unique user numbers

Cliff Stanford cliff at demon.co.uk
Sun Apr 28 07:29:48 AEST 1991


In article <1991Apr25.153217.9572 at oakhill.sps.mot.com> root at oakhill.sps.mot.com (Operator) writes:
>I was asked by a user how to retrieve/identify the unique
>user number from within the shell environment (ksh). What
>he is looking for would, preferably, function in much the
>same fashion as the command [echo `/usr/bin/logname`], where
>the result of this op could then be piped into a subsequent
>operation. 

	echo `grep \^\`/usr/bin/logname\` /etc/passwd | cut -d: -f3`

	Isn't shell quoting wonderful?	:-)
		Cliff
-- 
Cliff Stanford				Email:	cliff at demon.co.uk (Work)
Demon Systems Limited				cms at demon.co.uk   (Home)
42 Hendon Lane				Phone:	081-349 0063	  (Office)
London	N3 1TT	England				0860 375870	  (Mobile)



More information about the Comp.unix.shell mailing list