检测test.php脚本是否存在,不存在则启动
一下是我写的:总是报错,报错类似于
"
./test.sh: line 2: [: missing `]'
wc: ]: No such file or directory
no
"
if [ ps -ef | grep test.php | wc -l ]; then
echo 'starting'
else
echo 'restart'
php /xxx/xxx/test.php
fi
pgrep -f test.php
if [[ $? -eq 0 ]]; then
echo "Running"
else
echo "Not Running"
fi
[
和 ]
中间的应当是test命令支持的参数,而不是一个命令。