Created
February 10, 2015 15:55
-
-
Save ELLIOTTCABLE/3a945b04ed8170d710ac to your computer and use it in GitHub Desktop.
POSIX-compatible shell-script truthiness-checking cheat-sheet with-a hyphenated-title
This file contains 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
[ -n "${VAR##[NFnf]*}" ] && echo '$VAR must be truthy (but will be considered falsey by default, if empty)' | |
[ -z "${VAR##[YTyt]*}" ] && echo '$VAR must be truthy (and will be by default, if empty)' | |
[ -z "${VAR##[NFnf]*}" ] && echo '$VAR must be falsey (and will be by default, if empty)' | |
[ -n "${VAR##[YTyt]*}" ] && echo '$VAR must be falsey (but will be considered truthy by default, if empty)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment