Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Dec 1998 06:59:10 +0100
From:      "Matus \"fantomas\" Uhlar" <uhlar@fantomas.sk>
To:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: test -n
Message-ID:  <19981214065910.A9981@fantomas.sk>
In-Reply-To: <B0000095464@library.rcpl.org>; from Andrew Lankford on Sun, Dec 13, 1998 at 02:35:32PM -0500
References:  <B0000095464@library.rcpl.org>

next in thread | previous in thread | raw e-mail | index | archive | help
-> I have FreeBSD 2.2.5 installed on my computer, and I find that the 
-> syntax for "test" or "[" always is a major pain.
-> 
-> According to the man page (for CURRENT as well as 2.2.5)
-> "test -n $string" will be TRUE if $string is NOT of zero length.
-> 
-> # set string="fred"
-> # echo $string
-> fred
-> # [ -n $string ] && echo yeah
-> yeah
-> 
-> ...No surprise there, however....
-> 
-> # set string=""
-> # [ -n $string ] && echo yeah
-> yeah
-> #
-> 
-> Am I overlooking something (I'm using tcsh, but it does the same thing in
-> Bourne shell), or is this a bug?

try
[ -n "$string" ] && echo yeah
should work.
-- 
 Matus "fantomas" Uhlar, sysadmin at NETLAB+ Kosice, Slovakia
 BIC coord for *.sk; admin of netlab.irc.sk; co-admin of irc.felk.cvut.cz

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981214065910.A9981>