+

add -h/--help parameter on all scripts

Benjamin Renard [2012-03-22 16:56:43]
add -h/--help parameter on all scripts
Filename
run-all-backup
run-backup
diff --git a/run-all-backup b/run-all-backup
index 0c9e7dc..f002507 100755
--- a/run-all-backup
+++ b/run-all-backup
@@ -13,9 +13,7 @@ function usage() {
 	[ -n "$1" ] && exit 1 || exit 0
 }

-[ "$TYPE" == "-h" -o "$TYPE" == "--help" ] && usage
-
-[ ! -n "$TYPE" ] && TYPE=full
+[ ! -n "$TYPE" -o "$TYPE" == "-h" -o "$TYPE" == "--help" ] && TYPE=full

 if [ "$TYPE" == "incr" -o "$TYPE" == "INCR" ]
 then
diff --git a/run-backup b/run-backup
index e0b7748..e58214c 100755
--- a/run-backup
+++ b/run-backup
@@ -10,11 +10,11 @@ DEBUG=0

 function usage() {
 	[ -n "$1" ] && echo "[ERROR] $1" > /dev/stderr && echo
-	echo "usage : $0 [MACHINE] [incr|FULL] [-d]"
+	echo "usage : $0 [-h|--help] [MACHINE] [incr|FULL] [-d]"
 	[ -n "$1" ] && exit 1 || exit 0
 }

-[ ! -n "$MACHINE" ] && usage
+[ ! -n "$MACHINE" -o "$MACHINE" == "-h" -o "$MACHINE" == "--help" ] && usage

 [ ! -n "$TYPE" ] && TYPE=full
ViewGit