Created
May 21, 2025 15:23
-
-
Save undying/7f756b7e232402fef5c5c6b344299484 to your computer and use it in GitHub Desktop.
Transforms string into boolean value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function s_to_bool(){ | |
local s="${1}" | |
[[ -n "${s}" ]] || return 1 | |
case "${s}" in | |
[nN][oO]|[fF][aA][lL][sS][eE]|0) | |
return 1;; | |
*) return 0;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment