if [ ! -w "$logfile" ]
then echo "not writeable"
echo "not writeable again"
fi
注意空格,shell里面有的地方必须有空格,有的地方必须没有空格。[ ]前后都要有空格
if[! -w “$logfile” ]
把“”符号去掉试试。
改为:if[! -w $logfile ]
if语句后面有没有加结尾:fi ?
if [ ! -w "$logfile" ]; then
# 代码块
fi
注意所有符号为半角英文符号,还有空格