SHTK_ABORT(3) | Library Functions Manual | SHTK_ABORT(3) |
shtk_abort
—
Aborts the program with an optional error
message
shtk_abort |
[message1 .. messageN] |
The shtk_abort
function prints the given
error message to stderr and terminates execution of the script, including
all subshells leading up to the call to
shtk_abort
.
The exit code of the script is non-zero but unspecified.
The message, if provided, can be broken up as one or more arguments as depicted by message1 to messageN; all arguments are concatenated together into a single line.
It is important to note that shtk_abort
should be used exclusively to abruptly abort the script due to an internal
error or inconsistency. Think of this function as a mechanism to implement
assertions:
[ -n "${should_be_set}" ] || shtk_abort "Internal variable not set!"
This is why shtk_abort
is
not in the
shtk_cli(3) module, because it is
not meant to provide a mechanism for clean program terminations and because
it is provided for self-diagnostics purposes.
shtk_abort
first appeared in
shtk
1.7.
September 14, 2016 | Debian |