if [ -n "$x" ]; then ... else ... fi
if [ -z "$x" ]; then ... else ... fi
if [ ${#x} -eq 0 ]; then ... else ... fi
# a= # [[ ${#a} -eq 0 ]] && echo yes || echo no yes # a=x # [[ ${#a} -eq 0 ]] && echo yes || echo no no # a=123 # [[ ${#a} -eq 0 ]] && echo yes || echo no no # a=0 # [[ ${#a} -eq 0 ]] && echo yes || echo no no
[[ -z "$a" ]] && echo Empty || echo NotEmpty [[ ! -z "$a" ]] && echo NotEmpty || echo Empty [[ -n "$a" ]] && echo NotEmpty || echo Empty