diff options
Diffstat (limited to 'stow/vim/.vim/ftplugin/sh/snippets')
-rw-r--r-- | stow/vim/.vim/ftplugin/sh/snippets/template.txt | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/stow/vim/.vim/ftplugin/sh/snippets/template.txt b/stow/vim/.vim/ftplugin/sh/snippets/template.txt index 64d3a2e..171dcf8 100644 --- a/stow/vim/.vim/ftplugin/sh/snippets/template.txt +++ b/stow/vim/.vim/ftplugin/sh/snippets/template.txt @@ -4,7 +4,15 @@ # # Usage: template.sh [-ac] [-b OPTARG] FILE... -usageMessage="Usage: template.sh [-ac] [-b OPTARG] FILE..." +usageMessage="Usage: ${0} [-ac] [-b OPTARG] FILE..." + +error() { + printf '%s error: %s\n' "$0" "$*" >&2 +} + +errorAndUsage() { + printf '%s error: %s\n%s\n' "$0" "$*" "$usageMessage" >&2 +} # Process options while getopts ':ab:c' opt; do @@ -15,7 +23,7 @@ while getopts ':ab:c' opt; do ;; 'b' ) - echo b $OPTARG + echo b "$OPTARG" ;; 'c' ) @@ -23,11 +31,9 @@ while getopts ':ab:c' opt; do ;; '?' ) - printf "${usageMessage}\n" + printf '%s\n' "$usageMessage" exit 1 esac done -shift $(($OPTIND - 1)) - -<++> +shift $((OPTIND - 1)) |