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
相關文章
相關標籤/搜索