user_login.sh
时间:2010-12-17 来源:xyqcuijia
判断用户是否存在 显示用户登录次数 登录时间
#!/bin/bash
if grep "^${1}" /etc/passwd &> /dev/null;then
echo " $1 is exist and login times is:"
last | grep $1 | wc -l
last | grep $1 | awk '{print $4,$5,$6,$7}'
else
echo "$1 is not exist."
fi
last | grep $1 | wc -l
last | grep $1 | awk '{print $4,$5,$6,$7}'
else
echo "$1 is not exist."
fi
相关阅读 更多 +