summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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