# touch $$
# gzip $$
# gzip --test $$.gz
# echo $?
0
# OUT=$(gzip --test $$.gz)
# echo $OUT
# if [ -z $OUT ] ; then echo $$ ; fi
26521
# if [ -n $OUT ] ; then echo $$ ; fi
26521
#
from bash(1)
-z string True if the length of string is zero. string -n string True if the length of string is non-zero.
I'm confused, how is it zero and non-zero at the same time? How does one do check against if key has a value (using bash
)?