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] 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 ---