Date: Thu, 17 Aug 2006 13:20:25 GMT From: Florian Meister <florian.meister@medienhaus.at> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/102184: the -n switch of the test command does not work Message-ID: <200608171320.k7HDKPEk009801@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/102184; it has been noted by GNATS. From: Florian Meister <florian.meister@medienhaus.at> To: Maxim Konovalov <maxim@macomnet.ru> Cc: bug-followup@freebsd.org Subject: Re: bin/102184: the -n switch of the test command does not work Date: Thu, 17 Aug 2006 15:16:42 +0200 Hi Maxim, Maxim Konovalov wrote: > [...] >>> 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 > what about that: --snip-- tpextu02# set testvar="lala" ; [ -n $testvar ] ; echo $? ; echo $testvar 0 lala tpextu02# set testvar="" ; [ -n $testvar ] ; echo $? ; echo $testvar 0 --snap-- I have printed out the $testvar at the end to ensure the the variable is set correctly.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608171320.k7HDKPEk009801>