commit 02326398aebc9627b60a837d81d0d32866b4f4d6
parent 3a4f2ce6367fb3ae7df4a57a7afc6c1f22070bc7
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Mon, 4 Jan 2016 12:37:25 +0100
Merge pull request #89 from sorbits/exit-codes
Exit with non-zero return code on failure
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ansiweather b/ansiweather
@@ -96,14 +96,14 @@ jqpath=$(which jq)
if [ "$jqpath" = "" ]
then
echo "ERROR : Cannot find jq binary"
- exit
+ exit 69 # EX_UNAVAILABLE
fi
bcpath=$(which bc)
if [ "$bcpath" = "" ]
then
echo "ERROR : Cannot find bc binary"
- exit
+ exit 69 # EX_UNAVAILABLE
fi
@@ -188,7 +188,7 @@ fi
if [ -z "$weather" ]
then
echo "ERROR : Cannot fetch weather data"
- exit
+ exit 75 # EX_TEMPFAIL
fi
status_code=$(echo "$weather" | jq -r '.cod' 2>/dev/null)
@@ -196,7 +196,7 @@ status_code=$(echo "$weather" | jq -r '.cod' 2>/dev/null)
if [ "$status_code" != 200 ]
then
echo "ERROR : Cannot fetch weather data for the given location"
- exit
+ exit 69 # EX_UNAVAILABLE
fi