| www.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 |
| Date: | Fri, 19 Aug 2005 15:12:35 -0400 |
| From: | Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: bash test -n && test -z return tru |
| Message-ID: | <20050819191235.GA19495@trixie.casa.cgf.cx> |
| Reply-To: | cygwin AT cygwin DOT com |
| References: | <43062C7F DOT 8010906 AT pooryorick DOT com> |
| Mime-Version: | 1.0 |
| In-Reply-To: | <43062C7F.8010906@pooryorick.com> |
| User-Agent: | Mutt/1.5.8i |
On Fri, Aug 19, 2005 at 03:01:19PM -0400, Poor Yorick wrote: >from reading the bash man pages, I would have thought the -n and -z were >mutually exclusive. Therefore I don't understand this result: > >~>$ [ -n $(which nonexisingfilename 2>/dev/null) ] && [ -z $(which >nonexistingfilename 2&>/dev/null) ] && echo hello >hello >~>$ > >can anyone help explain this? This defaults to [ -n ] && [ -z ] && echo hello I would have expected a syntax error in that case. Regardless of that, however, if you want to actually make this work you need to do something like: [ -n "$(which nonexisingfilename 2>/dev/null)" ] cgf -- 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 |