% ERRORMSG(1) Version 3.2.0 | Scripts Documentation % Georg Voell - georg.voell@standby.cloud % (c)2024 Standby.cloud NAME ==== **errormsg** - (BASH Script) Prints an error message in red color to stderr. SYNOPSIS ======== | **errormsg** \[_options_] _errnum_ _errmsg_ \[_errrsn_] DESCRIPTION =========== Prints an error message in red color to stderr. This script can be called with 2 or 3 parameters. If "LOGFILE" is defined, it writes error message also to log. First parameter is the error number. Second parameter is the error message. Third (optional) parameter is the error reason. Options ------- -h, \--help          : Displays helptext. -v, \--version         : Displays the version of the script. -q, \--quiet          : Just write error message to LOGFILE. ErrNum ------- Number between 1 and 99. 0 for Warning messages ErrMsg ------- Error message to be displayed. ErrRsn ------- Optional: Error reason. EXAMPLES ======== **errormsg** 0 "No internet connection." : Will display the warning message "WARNING: No internet connection." to stderr. **errormsg** 1 "No 'curl' in PATH." : Will display the error message "ERROR(01): No 'curl' in PATH." to stderr. **errormsg** 2 "No internet connection." "No connection to external server" : Will display "ERROR(02): No insternet connection. (No connection to external server)" to stderr. export LOGFILE="${HOME}/test.log"; **errormsg** -q 3 "Can't delete file." : Will write "2020-06-01 14:37:51 ERROR(03): Can't delete file." to $LOGFILE. EXIT CODES ========== 01: Unknown or wrong parameter. 02: Could not create logfile. 03: Could not write to logfile. SEE ALSO ======== **install-scripts**(1)