shell???
发表于 : 2010-12-16 23:53
shell脚本里的命令如何以root用户执行,就像安装软件时提示输入root密码???
代码: 全选
if [[ `id -u` -ne 0 ]]; then
echo "Need to be ROOT to run install."
if [[ `which gksu >/dev/null` -ne 0 ]]; then
echo 'use `sudo` or `su -c` to switch to root.'
exit 1
fi
gksu $0
exit 0
fi