command line parsing implemented, implemented --force option to die(), few typos
This commit is contained in:
@@ -4,15 +4,21 @@
|
||||
function die()
|
||||
{
|
||||
local errorcode=$1
|
||||
prnt E "Sortie prématuré avec erreur (code #$errorcode)."
|
||||
exit $errorcode
|
||||
[[ $2 == "--force" ]] && unset KEEPGOING
|
||||
|
||||
if [[ $KEEPGOING ]]; then
|
||||
prnt E "Sortie prématuré avec erreur (code #$errorcode)."
|
||||
exit $errorcode
|
||||
else
|
||||
prnt W "On continue malgrés l'erreur #$errorcode."
|
||||
fi
|
||||
}
|
||||
export -f die
|
||||
|
||||
function terminate()
|
||||
{
|
||||
prnt E "$1 reçu, sortie immédiate."
|
||||
die 128
|
||||
die 128 --force
|
||||
}
|
||||
trap terminate 'Ctrl + C' SIGINT
|
||||
trap terminate 'SIGTERM' SIGTERM
|
||||
|
||||
Reference in New Issue
Block a user