环境准备
准备一台Centos6服务器
系统: Centos6.8
内存:1G
cpu: 2核
IP地址: 10.0.0.21
# 创建shell脚本
vim user.sh
#!/bin/bash
total_num=`cat /etc/passwd | wc -l`
user_num=`cat /etc/passwd | grep '/bin/bash' | wc -l`
nologin_user=$(($total_num-$user_num))
echo "不能登陆系统的用户: $nologin_user"
# 执行脚本
sh user.sh