在bash脚本中卷曲,但错误卷曲:(3)在URL中发现非法字符

时间:2018-08-30 09:39:59

标签: curl

我下面有脚本

echo Getting Data from MyTotalControl Website
/etc/openhab2/scripts/therm.py -s > /var/log/honeywell.log
TEMPDATA="/var/log/honeywell.log"
#
#
echo Checking Indoor Temp
TEMPSTATUS=$( grep "Indoor Temperature" "$TEMPDATA" | sed -n -e 's/^.*Indoor Temperature: //p')
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$TEMPSTATUS" "http://xxx.xxx.xxx.xxx:xxxxx/rest/items/IndTemp" "\n"
echo "$TEMPSTATUS"
#
#
exit 0

我得到了错误:

Getting Data from MyTotalControl Website
Checking Indoor Temp
curl: (3) Illegal characters found in URL
28
: numeric argument required: line 39: exit: 0

它获取室内温度,但是我有一个卷曲错误和那个数字参数。

当我在终端中使用curl命令

$ curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "33" "http://xxx.xxx.xxx.xxx:xxxxx/rest/items/IndTemp"

它按预期工作,并更新了我的商品。 我究竟做错了什么? 预先谢谢你。

0 个答案:

没有答案