[[email protected] day1]# vi checkroot.sh
#!/bin/bash
#检查是否是root用户
if [ $UID -ne 0 ];then
ehco Non root user. Please run as root.
else
echo "Root user"
fi
保存退出
[[email protected] day1]# bash checkroot.sh
Root user
[[email protected] day1]#
时间: 2024-10-13 02:21:31