我用什么方式可以显示当天系统的登录次数?例如。
日期,该用户登录名以及给定日期的登录次数。
将此添加到.bash_profile
:
touch .daily_login_count
read tomorrow count < .daily_login_count # It's OK if file is empty
# Check if this is the first login of the day
if (( $(date +%s) > tomorrow )); then
count=0
(( tomorrow += 86400 ))
fi
(( count++ ))
echo "$tomorrow $count" > .daily_login_count
echo "$(date) $user $count login(s) today"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句