标签:necessary change cannot null 用户
#!/bin/bash
#清除日志脚本
LOG_DIR=/var/log
ROOT_UID=0 #$UID为0的时候,用户具有root用户的权限
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script"
exit 1
fi
cd $LOG_DIR || { #|| 失败的意思
echo "cannot change to necessary directory " >&2
exit 1
}
cat /dev/null >messages &&echo "logs cleaned up"
exit 0
标签:necessary change cannot null 用户
原文地址:http://21024.blog.51cto.com/11024/1792286