add ok function to exit with a generic error message after a previous call went wring
This commit is contained in:
parent
ee8f3c1c75
commit
38d6c54c69
4
bsf.sh
4
bsf.sh
@ -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' ; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user