delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/03/27/20:29:56

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <38E00C6A.491129D3@veritas.com>
Date: Mon, 27 Mar 2000 17:35:38 -0800
From: Bob McGowan <rmcgowan AT veritas DOT com>
Organization: VERITAS Software
X-Mailer: Mozilla 4.7 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: earnie_boyd AT yahoo DOT com
CC: cygwin users <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: [FYI] Possible bash bug.
References: <20000327182429 DOT 29819 DOT qmail AT web111 DOT yahoomail DOT com>

Earnie Boyd wrote:
> 
> This isn't Cygwin specific; but covers all cases of bash.
> 
> mkdir /foo
> case "/foo" in [/\\]*) echo 1;; esac
> case "/foo" in [\\/]*) echo 2;; esac
> 
> The first test case fails to find the directory /foo.
> The second test case finds /foo and echos 2.

There is no doubt that this is a bug, since in 'ksh' both scenarios
generate output.

But I have a concern regarding the above.  It appears to imply that a
directory named "/foo" must exist and that the case statement is somehow
"finding" this directory.  This is not my understanding about how the
case statement works, in any of bash, ksh or sh.

Granted, the pattern uses the standard shell wildcard patterns (file
globbing, and not regular expressions as used by grep and others), but
the match is made against the value "/foo" and not against file names. 
Both of the above will work (correctly or incorrectly, as the case may
be ;-)), when run in a completely empty directory.

-- 
Bob McGowan
Staff Software Quality Engineer
VERITAS Software
rmcgowan AT veritas DOT com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019