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

Florian Meister florian.meister at medienhaus.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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 17 11:30:13 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Florian Meister
>Release:        FreeBSD 6.1-RELEASE amd64
>Organization:
Teleport Consulting and Systemmanagement GmbH
>Environment:
System: FreeBSD tpextu02.tele.net 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:15:57 UTC 2006 root at bloom.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP amd64


>Description:
	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.
>How-To-Repeat:
sample shell script: 
--snip--
jail_interface="lala"
if [ -n ${jail_interface} ]; then
                        echo "interface: -$jail_interface-"
                fi
--snap--

try to replace the variable jail_interface with nothing - same result. If you replace -n with -z you get the expected results.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list