hamacs/snippets/sh-mode/getopt

15 lines
227 B
Text
Raw Normal View History

# -*- mode: snippet -*-
# name: getopt
# uuid:
# key: getopt
# --
${1:OPT1}="${2:default value}"
$0
while getopts "${3:s}" o
do case "$o" in
$3) $1="$OPTARG";;
[?]) usage;;
esac
done
shift $(expr $OPTIND - 1)