校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > linux 判斷當(dāng)前用戶是否是root

linux 判斷當(dāng)前用戶是否是root

熱門標(biāo)簽:曲阜地圖標(biāo)注app 開封400電話辦理價格 內(nèi)蒙古電信外呼系統(tǒng) 哪個地圖標(biāo)注更清晰 4s店如何在百度地圖標(biāo)注 漳州外呼系統(tǒng)怎么樣 天津人工電銷機(jī)器人費(fèi)用 地圖標(biāo)注小區(qū)項(xiàng)目入駐 凱立德劇院地圖標(biāo)注
linux 中,如何判斷當(dāng)前用戶是否是root 呢?
判斷當(dāng)前用戶是否是root

復(fù)制代碼
代碼如下:

#---------------------------- root user check ---------------------start
if [ `id -u` -ne 0 ]; then
echo "Please re-run ${this_file} as root."
exit 1
fi
#---------------------------- root user check ---------------------end
if [ x"$USER" = x"" ];then
if id |grep "^uid=0(root)">/dev/null ;then
:
else
echo "Please rerun `basename $0` as root ."
exit 1
fi
else
if [ ! x"$USER" = x"root" ];then
echo "Please rerun `basename $0` as root ."
exit 1
fi
fi
#=============== check current user start ================
if [ ! $USER = root ];then
echo "Please rerun this script as root ."
exit 1
fi
#=============== check current user end ================
#!/bin/sh
if id |grep "^uid=0(root)">/dev/null ;then
echo is root
else
echo not root
fi
check_user(){
if [ $UID -ne 0 ];then
echo "Current user is not ROOT."
echo "Please rerun the installer as Root user."
exit 11
fi
}

標(biāo)簽:陽泉 黔南 南陽 綿陽 莆田 武漢 南京 開封

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《linux 判斷當(dāng)前用戶是否是root》,本文關(guān)鍵詞  linux,判斷,當(dāng)前,用戶,是否是,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《linux 判斷當(dāng)前用戶是否是root》相關(guān)的同類信息!
  • 本頁收集關(guān)于linux 判斷當(dāng)前用戶是否是root的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 墨竹工卡县| 武城县| 呼图壁县| 鄂托克前旗| 石楼县| 盘山县| 雷山县| 湄潭县| 沁源县| 吉隆县| 定南县| 马鞍山市| 沙河市| 高碑店市| 永济市| 烟台市| 巴青县| 喀喇沁旗| 大悟县| 平遥县| 邳州市| 寻乌县| 仲巴县| 区。| 文水县| 普兰县| 桃源县| 当涂县| 苏尼特右旗| 自治县| 庐江县| 麻栗坡县| 临沂市| 徐州市| 上蔡县| 鸡泽县| 宜兴市| 双牌县| 汉源县| 永清县| 农安县|