判断哪些用户登陆了系统-《shell脚本》

admin 2025-11-06 14:32:30 系统网络 来源:ZONE.CI 全球网 0 阅读模式
    1. #!/bin/bash
    2. declare -i count=0
    3. while true;do
    4. if who |grep -q -E "^root"
    5. then
    6. echo -e "用户root 登陆了系统\n 这是第$count 次"
    7. break
    8. else
    9. let count++
    10. fi
    11. sleep 3
    12. done
    01-shell脚本介绍-《shell脚本》 系统网络

    01-shell脚本介绍-《shell脚本》

    一、shell脚本是什么二、为什么要学shell,而不是其他计算机语言三、学习这门课程的优势四、学了能干什么五、学习什么内容六、学习的技巧七、成长路径八、学习环
    评论:0   参与:  14