delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
From: | "Bob Byrnes" <byrnes AT curl DOT com> |
Date: | Thu, 11 Nov 2004 13:22:10 -0500 |
In-Reply-To: | <NUTMEGQvdzhs1eAjT4300000686@NUTMEG.CAM.ARTIMI.COM> from "Dave Korn" (Nov 11, 1:07pm) |
Organization: | Curl Corporation |
X-Address: | 1 Cambridge Center, 10th Floor, Cambridge, MA 02142-1612 |
X-Phone: | 617-761-1238 |
X-Fax: | 617-761-1201 |
To: | cygwin AT cygwin DOT com |
Subject: | RE: if construct doesn't work in makefile |
Message-Id: | <20041111182210.DB4D4E54F@wildcard.curl.com> |
> > if test [-dc:/tools]; then ... > > ... in fact test seems to be happy with no spaces around the square > brackets. I think it may be only if you want to use the implicit form > of test that the brackets need to be separated with spaces from the test > inside them, so that bash spots them as a separate token. No, you *always* need to separate "test" tokens with spaces. The constructs ... test expr and [ expr ] ... are equivalent. Use either the "test" command or square brackets, but not both. If you do attempt to use square brackets in the expression, then they have no special significance. With a single argument, "test" just determines if the argument string is non-null. So the command ... test [-dc:/tools] ... always returns a true exit status, simply because the single argument string "[-dc:/tools]" is not empty. You can prove this by doing ... bash$ test [-d/does-not-exist] && echo yes yes ... or even ... bash$ test [1=2] && echo yes yes -- Bob -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |