简体   繁体   中英

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 .

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

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旁边的勾号

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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