Retrieving unique user numbers

Michael Stefanik mike at bria.UUCP
Sat Apr 27 14:00:52 AEST 1991


In an article, 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. 

How about ...

myuid() {
	expr "`id`" : 'uid=\([0-9]*\).*'
	}

echo "My uid is `myuid`"
-- 
Michael Stefanik, MGI Inc, Los Angeles | Opinions stated are never realistic
Title of the week: Systems Engineer    | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
If MS-DOS didn't exist, who would UNIX programmers have to make fun of?



More information about the Comp.unix.shell mailing list