-
Notifications
You must be signed in to change notification settings - Fork 98
Hassbian-config: share-log errorhandling #129
Conversation
a=$(cat $LOGFILE); curl -X POST -s -d "$a" https://hastebin.com/documents | awk -F '"' '{print "https://hastebin.com/"$4}' | ||
loglink=$(curl -X POST -s -d "$(cat $LOGFILE)" https://hastebin.com/documents | awk -F '"' '{print "https://hastebin.com/"$4}') | ||
if [[ $loglink != *"initial"* ]]; then | ||
echo $loglink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double quote to prevent globbing and word splitting.
a=$(cat $LOGFILE); curl -X POST -s -d "$a" https://hastebin.com/documents | awk -F '"' '{print "https://hastebin.com/"$4}' | ||
loglink=$(curl -X POST -s -d "$(cat $LOGFILE)" https://hastebin.com/documents | awk -F '"' '{print "https://hastebin.com/"$4}') | ||
if [[ $loglink != *"initial"* ]]; then | ||
echo $loglink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double quote to prevent globbing and word splitting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some cleanup of the spelling is needed.
if [[ $loglink != *"initial"* ]]; then | ||
echo "$loglink" | ||
else | ||
echo "There is an issue with your network conection, or with the hastebin API.." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capital H in Hastebin.
@@ -80,17 +80,35 @@ function check-permission { | |||
} | |||
|
|||
function share-log { | |||
if [ ! -f $LOGFILE ];then | |||
echo "No logfile exiting..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comma.
No logfile, exiting.
echo "$loglink" | ||
else | ||
echo | ||
echo "There is an issue with your network conection, or with the hasebin API.." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling:
"There is an issue with your network connection, or with the Hastebin API."
Fix spelling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling. Merging
Description:
This will better handle errors if hastebin is down.
Compare:
Old:
New:
Checklist:
If pertinent:
/docs