blob: 74e5658ca6086549de218b4917163fb090219dd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/bin/sh
# template.sh: A template for sh scripts
#
# Usage: template.sh [-ac] [-b OPTARG] FILE...
scriptName="${0##*/}"
usageMessage="Usage: ${scriptName} [-ac] [-b OPTARG] FILE..."
error() {
printf '%s error: %s\n' "$scriptName" "$*" >&2
}
errorAndUsage() {
printf '%s error: %s\n%s\n' "$scriptName" "$*" "$usageMessage" >&2
}
# Process options
while getopts 'ab:c' opt; do
case $opt in
'a' )
echo a
;;
'b' )
echo b "$OPTARG"
;;
'c' )
echo c
;;
'?' )
printf '%s\n' "$usageMessage" >&2
exit 1
esac
done
shift $((OPTIND - 1))
|