From 4c7b91bba468c089a14afd12d23b5025a9c45ac0 Mon Sep 17 00:00:00 2001 From: Jack-Benny Persson Date: Thu, 26 Dec 2013 18:58:45 +0100 Subject: [PATCH] Changed exit 2 to exit 1 as it seems to be The Right Thing since exit 2 is misuse-something --- Labb6/ovning1.sh | 2 +- Labb6/ovning2.sh | 4 ++-- Labb6/ovning3.sh | 4 ++-- Labb6/ovning4/calc.sh | 8 ++++---- Labb6/ovning5.sh | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Labb6/ovning1.sh b/Labb6/ovning1.sh index e333d65..bea61e6 100755 --- a/Labb6/ovning1.sh +++ b/Labb6/ovning1.sh @@ -12,7 +12,7 @@ Arg2=$2 # Sanity checks if [ $# -ne 2 ]; then printf "`basename $0` requires two arguments\n" - exit 2 + exit 1 fi printf "Argument 1 is ${Arg1}\n" diff --git a/Labb6/ovning2.sh b/Labb6/ovning2.sh index b4c7d9f..381c452 100755 --- a/Labb6/ovning2.sh +++ b/Labb6/ovning2.sh @@ -8,13 +8,13 @@ # Sanity check if [ $EUID -ne 0 ]; then echo "`basename $0` must run as root" - exit 2 + exit 1 fi rm /tmp/testdir/* 2> /dev/null if [ $? -ne 0 ]; then echo "Something went wrong when deleting files in /tmp/testdir/" - exit 2 + exit 1 fi exit 0 diff --git a/Labb6/ovning3.sh b/Labb6/ovning3.sh index d3a4f12..1b05113 100755 --- a/Labb6/ovning3.sh +++ b/Labb6/ovning3.sh @@ -12,12 +12,12 @@ Iterate=0 # Sanity checks if [ $# -ne 1 ]; then echo "`basename $0` requires one argument" - exit 2 + exit 1 fi if ! [ $Nr -eq $Nr &> /dev/null ]; then echo "Use only integers" - exit 2 + exit 1 fi # Define our functions diff --git a/Labb6/ovning4/calc.sh b/Labb6/ovning4/calc.sh index 1653bb7..982a295 100755 --- a/Labb6/ovning4/calc.sh +++ b/Labb6/ovning4/calc.sh @@ -12,15 +12,15 @@ Nr2=$2 # Sanity check if [ $# -ne 2 ]; then echo "`basename $0` requires two arguments" - exit 2 + exit 1 fi if ! [ $Nr1 -eq $Nr1 &> /dev/null ]; then echo "`basename $0` only takes integers" - exit 2 + exit 1 elif ! [ $Nr2 -eq $Nr2 &> /dev/null ]; then echo "`basename $0` only takes integers" - exit 2 + exit 1 fi # Define our functions @@ -72,7 +72,7 @@ case "$Calc" in ;; *) echo "Please use one the symlink add.sh/sub.sh/div.sh/tim.sh" - exit 2 + exit 1 ;; esac diff --git a/Labb6/ovning5.sh b/Labb6/ovning5.sh index e8f0b20..008c16b 100755 --- a/Labb6/ovning5.sh +++ b/Labb6/ovning5.sh @@ -19,7 +19,7 @@ Warn=10 # Warn a how many percent full? for bin in $Df $Awk $Sed $Logger $Mail; do if [ ! -x $bin ]; then echo "Can't execute $bin" - exit 2 + exit 1 fi done