add ok function to exit with a generic error message after a previous call went wring

This commit is contained in:
koksnuss 2018-09-23 15:09:50 +02:00
parent ee8f3c1c75
commit 38d6c54c69

4
bsf.sh
View File

@ -12,6 +12,10 @@ sayn () { printf %s "$*" ; }
## check if user is root
root () { [[ "$EUID" -eq 0 ]] ; }
## check if last call had errors
## if yes print generic error message and exit
ok() { [[ "$?" -ne 0 ]] && echo "ERROR, aborting." && exit 1; }
## colors
# use ANSI escape codes
normal () { printf '\033[0m' ; }