linux shell4 判断登录用户,而后重启关闭系统

# 其中的$LOGNAME 就是获取登录的用户名
shell


#!/bin/bash
#  if user is root rebold  else  change to root than  rebold
user=$LOGNAME
echo "$user"
if [ "$user" = "root" ]
then
echo " user is  root  rebort system"
init 6
else
echo "$user  end "
exit  1
fi
相关文章
相关标签/搜索