That is a workaround for older version of bash and uninitialized variables, I've had to use it many times.
Must have been a very old version. The oldest one I have access to is
bash-2.05b-305.1[0] and that has no problem with uninitialised
variables, or the use of -z as a test. Then again, I have always wrapped
variables in quotes so any tests I perform won't fail with empty
strings.
[0]
davjam@thargon:~> rpm -qi bash
Name : bash Relocations: (not relocatable)
Version : 2.05b Vendor: SuSE Linux AG,
Nuernberg, Germany
Release : 305.1 Build Date: Sat 24 Apr 2004
19:57:34 BST
Install date: Mon 01 Nov 2004 21:59:40 GMT Build Host: welles.suse.de
Group : System/Shells Source RPM:
bash-2.05b-305.1.src.rpm
Size : 2401001 License: GPL
Signature : DSA/SHA1, Sat 24 Apr 2004 22:00:05 BST, Key ID
a84edae89c800aca
Packager : http://www.suse.de/feedback
URL : http://www.gnu.org/software/bash/bash.html
Summary : The GNU Bourne-Again Shell
Description :
Bash is an sh-compatible command interpreter that executes commands
read from standard input or from a file. Bash incorporates useful
features from the Korn and C shells (ksh and csh). Bash is intended to
be a conformant implementation of the IEEE Posix Shell and Tools
specification (IEEE Working Group 1003.2).
Authors:
--------
Brian Fox