简体   繁体   English

意外的EOF,缺少报价或反引号?

[英]unexpected EOF, missing quote or backtick?

I'm working on a script that in use with other scripts can send system or other notifications through Telegram , the script pulls the data from domoticz . 我正在研究一个脚本,该脚本与其他脚本一起使用可以通过Telegram发送系统或其他通知,该脚本从domoticz中提取数据。

I'm sure i'm missing a quote or backtick somewhere but i hope someone is kind enough to read over the small script and provide a fresh pair of eyes to see where i messed up: 我确定我在某处缺少引号或反引号,但我希望有人足够善良,可以阅读小脚本,并提供一双新鲜的眼睛,看看我搞砸了什么:

#!/bin/bash

# Settings
TelegramSendMsg="/opt/telegram/scripts/generic/telegram.sh"
TmpFileName="/opt/telegram/scripts/tmp/SystemStatus.txt"
SendMsgTo=$1

#Send sensor values with telegram
##############################################################################
ResultString+="CPU Usage: "
ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=8" 2>/dev/null` | jq -r .result[].Data`
ResultString+="\n"

ResultString+="Memory Usage: "
ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=1" 2>/dev/null | jq -r .result[].Data`
ResultString+="\n"

ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=6" 2>/dev/null | jq -r .result[].Name`
ResultString+=" : "
ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=6" 2>/dev/null | jq -r .result[].Data`
ResultString+="\n"

ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=4" 2>/dev/null | jq -r .result[].Name`
ResultString+=" : "
ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=4" 2>/dev/null | jq -r .result[].Data`
ResultString+="\n"

ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=5" 2>/dev/null | jq -r .result[].Name`
ResultString+=" : "
ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=5" 2>/dev/null | jq -r .result[].Data`
ResultString+="\n"

ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=3" 2>/dev/null | jq -r .result[].Name`
ResultString+=" : "
ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=3" 2>/dev/null | jq -r .result[].Data`
ResultString+="\n"

ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=2" 2>/dev/null | jq -r .result[].Name`
ResultString+=" : "
ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=2" 2>/dev/null | jq -r .result[].Data`
ResultString+="\n"

##############################################################################
echo -e $ResultString > $TmpFileName
$TelegramSendMsg send_text $SendMsgTo $TmpFileName

Stackoverflow's syntax highlite tells that something wrong here Stackoverflow的语法highlite告诉我们这里有问题

ResultString+=`curl "http://192.168.1.141:8086/json.htm?type=devices&rid=8" 2>/dev/null` | jq -r .result[].Data`

It is backtick here 在这里倒勾

null`

您的问题似乎是第11行的null旁边的勾号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM