blob: b9b7075cf6df9159eb66280ca7428cd9fe77faa2 (
plain)
- #!/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
|