From ba3ca3e10f4975510dfeedcb6dfe8e2374ca3097 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sat, 11 Jul 2009 16:25:52 -0400 Subject: improve function to get primary group to make it more portable --- src/share/common | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/share/common') diff --git a/src/share/common b/src/share/common index bd887d3..76b539f 100644 --- a/src/share/common +++ b/src/share/common @@ -483,6 +483,12 @@ get_homedir() { eval "echo ~${uname}" } +# return the primary group of a user +get_primary_group() { + local uname=${1:-`whoami`} + groups "$uname" | sed 's/^..* : //' | awk '{ print $1 }' +} + ### CONVERSION UTILITIES # output the ssh key for a given key ID -- cgit v1.2.3