方式一:
1
2
3
4
5
|
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to run"
exit 1
fi
|
方式二:
1
2
|
# Check if user is root
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
|
文章作者
cnbattle
上次更新
2018-06-26
许可协议
知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议