#!/bin/bash
log_dir=/var/log
root_uid=0
if [ $UID -ne $root_uid ];then
echo "must be root run this script."
exit 10
else
echo "user is root"
fi
cd $log_dir || {echo "can not change necessary diretory." >&2 exit 11}
cat /dev/null > messages
echo "logs cleaned up."
exit 0
log_dir=/var/log
root_uid=0
if [ $UID -ne $root_uid ];then
echo "must be root run this script."
exit 10
else
echo "user is root"
fi
cd $log_dir || {echo "can not change necessary diretory." >&2 exit 11}
cat /dev/null > messages
echo "logs cleaned up."
exit 0
编辑回复