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: | Mon, 18 Apr 2005 11:58:52 -0400 |
From: | Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Possible bash incompatibility |
Message-ID: | <20050418155852.GF11016@trixie.casa.cgf.cx> |
Reply-To: | cygwin AT cygwin DOT com |
References: | <BAY20-F859F5D44AF9EA3A9E691DD6290 AT phx DOT gbl> <Pine DOT GSO DOT 4 DOT 61 DOT 0504181047370 DOT 19797 AT slinky DOT cs DOT nyu DOT edu> |
Mime-Version: | 1.0 |
In-Reply-To: | <Pine.GSO.4.61.0504181047370.19797@slinky.cs.nyu.edu> |
User-Agent: | Mutt/1.5.8i |
On Mon, Apr 18, 2005 at 10:59:10AM -0400, Igor Pechtchanski wrote: >On Mon, 18 Apr 2005, Arash Partow wrote: >>Could someone tell me why the piece of bash script below is being >>rejected as being erroneous on cygwin but works fine on other bash's >>ie: linux and openbsd? > >I would imagine because the output of "uname -s" doesn't contain >"CYGWIN" on either Linux or OpenBSD, so "grep -c" outputs a 0. But >even on Cygwin this works (as Brian already confirmed). > >>my current version of bash is update (2.05b). >> >>#!/bin/bash >> >>if [ `uname -s | grep -c 'CYGWIN'` -eq "1" ]; then > >FWIW, a better test would be > >if uname -s | grep -q 'CYGWIN'; then ... How about if [[ $(uname -s) == CYGWIN* ]]; then 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 |