我有一个bash脚本,它每15秒运行一个PHP脚本,每5分钟运行第二个PHP脚本。然而,我的对手这样做是行不通的。我找不到窃听器在哪里。
#!/bin/bash
while (true)
do
sleep 1
if (( count % 15 == 0 )) ;then
php test.php
fi
if (( count % 300 == 0 )); then
php test2.php
count=0
fi
(( count = count +1 ))
done当我运行这个脚本时,它在控制台中给出了这个错误:
script.sh: 8: script.sh: count: not found
script.sh: 11: script.sh: count: not found
script.sh: 16: script.sh: count: not found
script.sh: 8: script.sh: count: not found
script.sh: 11: script.sh: count: not found
script.sh: 16: script.sh: count: not found我尝试在循环之前实例化计数器,但结果是相同的。任何帮助都将不胜感激!
发布于 2014-06-18 14:24:26
您可能使用sh而不是bash来执行脚本。确保您使用./script.sh直接执行它(以便使用shebang二进制文件),或者使用bash bash script.sh显式调用它。
https://stackoverflow.com/questions/24287719
复制相似问题