SHTK_BOOL_CHECK(3)
π SHTK_BOOL_CHECK(3) π
okay so bestie, welcome to the shtk_bool_check page β it's a library function from the shtk manual, section 3, and it's literally about turning a string into a boolean. no cap, it's simpler than it sounds. π¦
πΈ LIBRARY πΈ
shtk_import bool
like, you gotta import it first, obviously. π
β¨ SYNOPSIS β¨
shtk_bool_check value [error_message]
π DESCRIPTION π
so the shtk_bool_check function takes the string value and returns the corresponding boolean value according to shell conventions. that's it. that's the whole vibe. β¨
β RETURN VALUES β
shtk_bool_checkreturns0for any value representing truth. these include the stringsβyesβandβtrueβ, including any variations in their capitalization, and the integer numberβ1β. slay. πshtk_bool_checkreturns1for any value representing falsehood. these include the stringsβnoβandβfalseβ, including any variations in their capitalization, and the integer numberβ0β. periodt. π
π EXAMPLES π
local verbose=no
# Parse flags to see if verbose mode is enabled and set verbose=yes.
if shtk_bool_check "${verbose}"; then
# Print messages.
fi
like, see how it's used? it's giving "clean little conditional" and we're obsessed. π«Ά
π ERRORS π
shtk_bool_check prints the error given in error_message and exits the shell with non-zero if the value does not represent a valid boolean value. and if error_message is not provided, a default message is printed. so yeah β pass your message or get the default one, either way you're covered. π
π¦ SEE ALSO π¦
π HISTORY π
shtk_bool_check first appeared in shtk 1.4. iconic behavior, honestly. β
and that's the whole page, bestie π this beauty comes from Debian, dated November 5, 2014 β go forth and boolean-check responsibly. πΈπ
π¦ where this page comes from
- nixos 26.05: shtk 1.7
- nixpkgs unstable: shtk 1.7
- Copyright 2014 Google Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms