0
这是shell代码我运行:意外操作失误
#!bin/bash
while true
do
req=$(curl http://localhost/devcalls/camerarequest.php)
if [ "$req" == "1" ]
then
sudo bash /home/ckoy-admin/HAS_system/camera/cam.sh
fi
done
,这是我得到的错误,当我执行:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1 100 1 0 0 56 0 --:--:-- --:--:-- --:--:-- 58
CAM.sh: 7: [: 1: unexpected operator
请让我知道什么是错的这里。
我能想到的是在文件中可能会有一些不可见的字符。你用'vi'输入了吗? – Jack
你如何运行脚本? – choroba
显示'echo“$ req”|的内容hexdump -C'。用'cat -A file'或'cat -v file'检查文件中的特殊字符。 – Cyrus