From e1baa6d38e5b274e77711270a16adfd6d73a4f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A8switch87=C2=A8?= <¨gert@gepe-biljarts.be¨> Date: Sat, 28 Feb 2015 22:50:06 +0100 Subject: [PATCH 1/2] changed snippet getopts to work correctly --- snippets/sh.snippets | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/snippets/sh.snippets b/snippets/sh.snippets index c9c6ebc..4c11258 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -51,15 +51,13 @@ snippet getopt #=============================================================================== function usage () { - cat <<- EOT + echo " + Usage : $${0:0} [options] [--] - Usage : $${0:0} [options] [--] + Options: + -h|help Display this message + -v|version Display script version" - Options: - -h|help Display this message - -v|version Display script version - - EOT } # ---------- end of function usage ---------- #----------------------------------------------------------------------- @@ -74,7 +72,7 @@ snippet getopt v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;; - \? ) echo -e "\n Option does not exist : $OPTARG\n" + * ) echo -e "\n Option does not exist : $OPTARG\n" usage; exit 1 ;; esac # --- end of case --- From c5b88e2b6761c439ccd989d81293fff64ea403e1 Mon Sep 17 00:00:00 2001 From: Gert Date: Sat, 28 Feb 2015 23:28:34 +0100 Subject: [PATCH 2/2] Little update in echo command --- snippets/sh.snippets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snippets/sh.snippets b/snippets/sh.snippets index 4c11258..910fe8b 100644 --- a/snippets/sh.snippets +++ b/snippets/sh.snippets @@ -51,8 +51,7 @@ snippet getopt #=============================================================================== function usage () { - echo " - Usage : $${0:0} [options] [--] + echo "Usage : $${0:0} [options] [--] Options: -h|help Display this message