Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Dec 1998 09:28:24 +0100 (CET)
From:      List User <listuser@netspace.net.au>
To:        freebsd-bugs@FreeBSD.ORG
Message-ID:  <199812140828.JAA10623@doorway.home.lan>

next in thread | raw e-mail | index | archive | help
Newsgroups: freebsd.bugs
Path: root
From: "Matus \"fantomas\" Uhlar" <uhlar@fantomas.sk>
Subject: Re: test -n
Content-Type: text/plain; charset=us-ascii
Received: (from uhlar@localhost)
	by fantomas.fantomas.sk (8.8.8/8.8.8/Debian/GNU) id GAA10017
	for freebsd-bugs@FreeBSD.ORG; Mon, 14 Dec 1998 06:59:10 +0100
To: freebsd-bugs
Sender: owner-freebsd-bugs@FreeBSD.ORG
Mail-Followup-To: freebsd-bugs@FreeBSD.ORG
Organization: Private News Host
Message-ID: <19981214065910.A9981@fantomas.sk>
X-Mailer: Mutt 0.93i
References: <B0000095464@library.rcpl.org>
X-Uidl: f13f2368a24a31dfcd76e8f928d038d4
X-Loop: FreeBSD.org
Mime-Version: 1.0
In-Reply-To: <B0000095464@library.rcpl.org>; from Andrew Lankford on Sun, Dec 13, 1998 at 02:35:32PM -0500
Date: Mon, 14 Dec 1998 05:59:10 GMT

-> 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



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?199812140828.JAA10623>