Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Why zsh chose to be non-compliant in pattern matching
- X-seq: zsh-workers 38030
- From: Cuong Manh Le <cuong.manhle.vn@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Why zsh chose to be non-compliant in pattern matching
- Date: Fri, 26 Feb 2016 08:02:51 +0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=OcgL5Gl6MgS22ka+6QsnpYStLrF96e4T+RapdFxrI1k=; b=Ka4iy2e5BpUhrOkxVuv4cRNdY5mVgHtvQCkF+5T0p7KMj2/zGWvBRTaL9Yf9/A+ssS 0snAwUV6Ta+THIclmvv9V2wJmmfsVj/9yfua9tE/BDvcrNLOcXHbjUS/dAC7JjZf6DXp qtnj1clvaGI6dnPTVIN5CfIEhdBV3UFwc7rla4Nb+Mx3nPn8oHHqJ8YgCvTc+ynwC2rf AObbZbFXj2pQyrKf0TzvV2KmFgQXOj+wWvlOimi8ZrqdtPvfklQrpzkEfQM/4nIsasuq 0Ycw7b8JWVpa3AO2wIvooc+84zgNLi7fpbU7MeYbsWS0x8yMNz2n81drutqgr5yRsmQ6 wbyw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
POSIX documentation for pattern matching (
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_01)
said that any quoted characters in pattern will be match literally.
AFAICT, `["!"a]` will match `!` or `a`, most of shell behave like that
except zsh (and also ksh):
case a in ["!"a]) echo 1;; esac
print nothing. While:
case b in ["!"a]) echo 1;; esac
print 1. zsh treats `["!"a]` the same as `[!a]`.
Is there any reason for this behavior?
PS: The full question can be seen here
http://unix.stackexchange.com/q/265431/38906
Thanks.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author