TLDR
test -n
returns true iff string is unset or (set and non-zero); (in fact because -n didn’t receive any string)
test -z
return true iff string is unset or (set and zero);
Strange -n
1# ttt is not set2if test -n $ttt3 echo 14else5 echo 06end
This outputs 1. (Strange)
1set ttt ""2if test -n $ttt3 echo 14else5 echo 06end
This outputs 0.
Command -z
1if test -z $ttt2 echo 13else4 echo 05end
This outputs 1.
1set ttt ""2if test -z $ttt3 echo 14else5 echo 06end
This still outputs 1. Consistent.