bin/102184: the -n switch of the test command does not work

Florian Meister florian.meister at
Thu Aug 17 11:30:15 UTC 2006

>Number:         102184
>Category:       bin
>Synopsis:       the -n switch of the test command does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 17 11:30:13 GMT 2006
>Originator:     Florian Meister
>Release:        FreeBSD 6.1-RELEASE amd64
Teleport Consulting and Systemmanagement GmbH
System: FreeBSD 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:15:57 UTC 2006 root at amd64

	test -n does not work. I always get a return code of zero, no matter if the variable has zero or more characters. I crosschecked it with the -z switch. This switch works with the same test-script.
sample shell script: 
if [ -n ${jail_interface} ]; then
                        echo "interface: -$jail_interface-"

try to replace the variable jail_interface with nothing - same result. If you replace -n with -z you get the expected results.

More information about the freebsd-bugs mailing list