--> 在脚中有时需要检测运行脚本的有效有户ID是否是root用户
#!/bin/bashTIPS:这里的临时文件的文件名值得学习.
# Init
FILE="/tmp/out.$$"
GREP="/bin/grep"
#....
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 2>&1
exit 1
fi
#!/bin/bashTIPS:这里的临时文件的文件名值得学习.
# Init
FILE="/tmp/out.$$"
GREP="/bin/grep"
#....
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 2>&1
exit 1
fi
发送引用通告网址: http://supersun.info/mt/mt-tb.cgi/811
如果您想引用这篇日记到您的Blog,请复制上面的链接,放置到您发表文章时的相应界面中。
发表评论