30 lines
336 B
Bash
Executable file
30 lines
336 B
Bash
Executable file
#!/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 "$@"
|