summaryrefslogtreecommitdiff
path: root/localuserinfo
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2003-08-26 07:57:05 +0000
committerJonas Smedegaard <dr@jones.dk>2003-08-26 07:57:05 +0000
commit7e144b58bb657edca39ce3447885a36d58fa13ee (patch)
treebcbf80600faa5680eb497373619e9948c7d6b4f5 /localuserinfo
parent9f2962f49bfb055116ec4efb4176a2d1e316cd53 (diff)
New script localuserinfo: show realname and/or other info about user.
Diffstat (limited to 'localuserinfo')
-rwxr-xr-xlocaluserinfo22
1 files changed, 22 insertions, 0 deletions
diff --git a/localuserinfo b/localuserinfo
new file mode 100755
index 0000000..b9b7075
--- /dev/null
+++ b/localuserinfo
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# /usr/local/bin/localuserinfo
+# Copyright 2003 Jonas Smedegaard <dr@jones.dk>
+#
+# $Id: localuserinfo,v 1.1 2003-08-26 07:57:05 jonas Exp $
+#
+# Print real name and/or other info for user
+#
+# TODO: Options to print other info than realname
+#
+
+function get_fullname_field() { getent passwd $1 | awk -F: '{print $5}' | awk -F, '{print $1}'; }
+function get_roomnumber_field() { getent passwd $1 | awk -F: '{print $5}' | awk -F, '{print $2}'; }
+function get_other_field() { getent passwd $1 | awk -F: '{print $5}' | awk -F, '{print $5}'; }
+function get_groups() { groups $1 | sed -e 's/^.*: //' -e "s/\( \+\|^\)$1\( \+\|$\)/\1/"; }
+function get_domain() { echo $1 | egrep "^@[\.[:alnum:]-]+$" | sed -e 's/@//'; }
+function get_account() { echo $1 | egrep "^([\.[:alnum:]_-]+|\+)@($gid|$maildomain)?$" | sed -e 's/@.*//'; }
+
+for uid in $@; do
+ get_fullname_field $uid
+done