hamacs/snippets/bash-mode/getopt

13 lines
215 B
Text
Raw Normal View History

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