From d7d5934b4d71cda53cae890752c681d23ef83961 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 11 Jun 2014 11:52:35 +1200 Subject: Use explicit error codes for exit calls Probably best not to rely on bash to carry the exit value forward correctly; clearer this way anyway --- bin/nwatch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/nwatch b/bin/nwatch index 6a35f84..6aaa076 100755 --- a/bin/nwatch +++ b/bin/nwatch @@ -37,7 +37,7 @@ latest=$cachedir/${self}.scan.latest # If the cachedir doesn't exist, attempt to create it, otherwise give up if [[ ! -d "$cachedir" ]] ; then if ! mkdir -- "$cachedir" ; then - exit + exit 1 fi fi @@ -48,7 +48,7 @@ diff=$cachedir/${self}.diff.${date} # Run the scan or give up if ! nmap -v -T4 -sV -iL "$hostlist" -oA "$cache" >/dev/null ; then - exit + exit 1 fi # If the link to the XML file is legible, run the diff or give up @@ -58,7 +58,7 @@ if [[ -r ${latest}.xml ]] ; then # Because we always want a report, only exit if an actual error condition # (1 means there's a meaningful diff in the scans) if (($? == 2)) ; then - exit + exit 1 fi fi -- cgit v1.2.3