SHTK_ABORT(3)

NAME
shtk_abort - Aborts the program with an optional error message

SYNOPSIS
shtk_abort [message1 .. messageN]

DESCRIPTION
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.

SEE ALSO
shtk(3), shtk_cli(3)

HISTORY
shtk_abort first appeared in shtk 1.7.