changed snippet getopts to work correctly

This commit is contained in:
¨switch87¨ 2015-02-28 22:50:06 +01:00
parent b11832aa68
commit e1baa6d38e

View File

@ -51,15 +51,13 @@ snippet getopt
#=============================================================================== #===============================================================================
function usage () function usage ()
{ {
cat <<- EOT echo "
Usage : $${0:0} [options] [--] Usage : $${0:0} [options] [--]
Options: Options:
-h|help Display this message -h|help Display this message
-v|version Display script version -v|version Display script version"
EOT
} # ---------- end of function usage ---------- } # ---------- end of function usage ----------
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -74,7 +72,7 @@ snippet getopt
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;; 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 ;; usage; exit 1 ;;
esac # --- end of case --- esac # --- end of case ---