Linux -Shell编程学习例子--希望有空继续添加

Shell脚本判断当前登录用户是否为root

# !/bin/bash
currentName=`whoami`
echo $currentName
if [ "$currentName" = "root" ]
 then
 echo "Current Login User is root"
else
 echo "Current Login User is :"$currentName
fi

学习资料
Shell编程-01-Shell脚本初步入门

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章