Skip to content

Instantly share code, notes, and snippets.

@undying
Created May 21, 2025 15:23
Show Gist options
  • Save undying/7f756b7e232402fef5c5c6b344299484 to your computer and use it in GitHub Desktop.
Save undying/7f756b7e232402fef5c5c6b344299484 to your computer and use it in GitHub Desktop.
Transforms string into boolean value
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