Is there any difference between the following tests?
[[ "$STRING" = "" ]] && exit 1;
[[ "x$STRING" = "x" ]] && exit 1;
[[ -z $STRING ]] && exit 1;
Nope, they are all the same. But couple of defensive habits to get into.
$STRING in the -z one as well${STRING-} just in case its not set at all$STRING when using the [[ keyword?Apparently, they all do the same thing, that is check if the given string its "empty", except that the first one checks if $string its empty, the second checks whether x plus $string its equals to x and finally, -z that checks the length. Personally I'd ratter go with -z that's more realiable.
[[ -z "$STRING" && -z "$OTHER" ]].