SHTK_ABORT(3)
β¨ SHTK_ABORT(3) β¨
okay bestie, buckle up, because today we're talking about shtk_abort from the shtk library functions manual and honestly? it's giving "dramatic exit" energy and i'm kind of obsessed π
πΈ NAME πΈ
shtk_abort β aborts the program with an optional error message, no cap, it just straight up ends things π
π SYNOPSIS π
shtk_abort [message1 .. messageN]
π¦ DESCRIPTION π¦
so the shtk_abort function prints whatever error message you hand it over to stderr and then terminates execution of the script β and not just the main script, bestie, it takes out all the subshells leading up to the call to shtk_abort too. like, the whole family tree. π
the exit code of the script is non-zero but unspecified β so yes it's a fail, but don't @ me asking which fail, because it does not say. π
the message, if you even provide one, can be broken up into one or more arguments, which is what message1 through messageN are about β¨ β all of those arguments get concatenated together into a single line. so go ahead and split your sentence up across args, it'll come out as one pretty line in the end π«Ά
π important note incoming: shtk_abort should be used exclusively to abruptly abort the script because of an internal error or inconsistency. think of this function as your mechanism for implementing assertions, iykyk:
[ -n "${should_be_set}" ] || shtk_abort "Internal variable not set!"
and this is exactly why shtk_abort is not in the shtk_cli(3) module, bestie β because it is not meant to provide a mechanism for clean program terminations, and because it is provided for self-diagnostics purposes. it's the "something is deeply wrong, we ride at dawn (to the exit)" function, not the "we finished tidily, bye" function. periodt. π
π SEE ALSO π
β HISTORY β
shtk_abort first appeared in shtk 1.7 β¨ iconic debut honestly.
and that's the whole page, babe π this little gem comes to you from the Debian crew, dated September 14, 2016 β so yes, it's been slaying in the shtk 1.7 era since way back π go forth and abort responsibly (internal errors only, fr fr) π¦
π¦ where this page comes from
- nixos 26.05: shtk 1.7
- nixpkgs unstable: shtk 1.7
- Copyright 2016 Google Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms