From owner-freebsd-bugs@FreeBSD.ORG Thu Aug 17 13:01:39 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F34E716A4DE for ; Thu, 17 Aug 2006 13:01:38 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 09BA243E27 for ; Thu, 17 Aug 2006 13:00:45 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k7HD0bQH008211 for ; Thu, 17 Aug 2006 13:00:37 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k7HD0baA008210; Thu, 17 Aug 2006 13:00:37 GMT (envelope-from gnats) Date: Thu, 17 Aug 2006 13:00:37 GMT Message-Id: <200608171300.k7HD0baA008210@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Maxim Konovalov Cc: Subject: Re: bin/102184: the -n switch of the test command does not work X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Maxim Konovalov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2006 13:01:39 -0000 The following reply was made to PR bin/102184; it has been noted by GNATS. From: Maxim Konovalov To: Florian Meister Cc: bug-followup@freebsd.org Subject: Re: bin/102184: the -n switch of the test command does not work Date: Thu, 17 Aug 2006 16:56:16 +0400 (MSD) Hi Florian, [...] > >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. Works for me: $ /bin/test -n "aa"; echo $? 0 $ /bin/test -n ""; echo $? 1 $ export n="aa"; /bin/test -n "$n"; echo $? 0 $ export n=""; /bin/test -n "$n"; echo $? 1 > >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. -- Maxim Konovalov