inbox-reddit: fix unread when it is not always an integer (#44)

This commit is contained in:
Terencio Agozzino 2018-05-19 15:38:05 +02:00 committed by x70b1
parent b68807a2ae
commit c39acf19c6

View File

@ -3,6 +3,11 @@
url="your url here" url="your url here"
unread=$(curl -sf "$url" | jq '.["data"]["children"] | length') unread=$(curl -sf "$url" | jq '.["data"]["children"] | length')
case "$unread" in
''|*[!0-9]*)
unread=0
esac;
if [ "$unread" -gt 0 ]; then if [ "$unread" -gt 0 ]; then
echo "#1 $unread" echo "#1 $unread"
else else