summaryrefslogtreecommitdiff
path: root/src/share/common
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@finestructure.net>2009-07-11 16:25:52 -0400
committerJameson Graef Rollins <jrollins@finestructure.net>2009-07-11 16:25:52 -0400
commitba3ca3e10f4975510dfeedcb6dfe8e2374ca3097 (patch)
tree5f15be76c1be31fd6fed62d544cf592de1421f68 /src/share/common
parent3e5df3def466a61cd32bdcc1fd29da09dff43729 (diff)
improve function to get primary group to make it more portable
Diffstat (limited to 'src/share/common')
-rw-r--r--src/share/common6
1 files changed, 6 insertions, 0 deletions
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