[FYI] Possible bash bug.

Bob McGowan rmcgowan@veritas.com
Mon Mar 27 17:28:00 GMT 2000

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

Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

More information about the Cygwin mailing list