feat(core): add script
This commit is contained in:
commit
ae909b8305
29
script
Executable file
29
script
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/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 "$@"
|
Loading…
Reference in a new issue