检测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
检测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
7 回答5.6k 阅读
4 回答4.2k 阅读
2 回答964 阅读✓ 已解决
2 回答3.5k 阅读
1 回答1.2k 阅读✓ 已解决
2 回答1.4k 阅读✓ 已解决
1 回答571 阅读✓ 已解决
[
和]
中间的应当是test命令支持的参数,而不是一个命令。