1
我想编写一个运行的shell,直到有东西写入文件(由另一个进程)。我写了这个:如何编写shell脚本?
PID_FILE=log.txt
DONE=0
while [$DONE -eq 0]
do
cat $PID_FILE | while read LINE
do
if [$LINE -neq ""]; then
echo "Do stuff here"
$DONE=1
fi
done
done
echo "DONE"
echo "">$PID_FILE
,但我得到
test.sh: 3: test.sh: [0: not found
DONE
[$ DONE -eq 0] => [$ DONE -eq 0],顺便说一下,您可以使用测试程序来代替[命令。 – BigMike 2013-02-28 08:38:31