获取用户名 #
exp1:
#!/bin/bash
ARGCOUNT=1
E_ARGEXIT=65
FILE=/etc/passwd
if [ $# -ne $ARGCOUNT ]
then
echo "Usage: `basename $0` USERNAME"
exit $E_ARGEXIT
fi
find_user ()
{
while read line
do
echo "$line" | awk -F ":" '{print $5}' | grep $1
done
}<$FILE
find_user $1
exit 0