30 lines
336 B
Plaintext
30 lines
336 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
usage() {
|
||
|
printf "Usage: %s [options]\n" "$0"
|
||
|
}
|
||
|
|
||
|
on_interrupt() {
|
||
|
print "Process aborted!\n"
|
||
|
|
||
|
exit 130
|
||
|
}
|
||
|
|
||
|
main() {
|
||
|
while getopts "hf:" option; do
|
||
|
case "${option}" in
|
||
|
h) usage; exit 0;;
|
||
|
f) FOO="$OPTARG";;
|
||
|
*) usage; exit 1;;
|
||
|
esac
|
||
|
done
|
||
|
|
||
|
FOO="${FOO:-defaultValue}"
|
||
|
|
||
|
exit 0
|
||
|
}
|
||
|
|
||
|
trap on_interrupt INT
|
||
|
|
||
|
main "$@"
|