vim shell.sh
read -p "please input a username:" MYUSER
if cut -d: -f1 |grep "^$MYUSER$" /etc/passwd &>/dev/null
then
MYSHELL=`grep "^MYUSER" /etc/passwd | cut -d: -f7 `
echo "${MYUSER}'s shell is $MYSHELL"
else
echo "$MYUSER is not exist"
fi
本文轉自 張玉坡 51CTO部落格,原文連結:http://blog.51cto.com/fighter/462778