delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
In-Reply-To: | <af0faace0906042210g70bfbe65n34c9a7f3079eb148@mail.gmail.com> |
References: | <af0faace0906042210g70bfbe65n34c9a7f3079eb148 AT mail DOT gmail DOT com> |
Date: | Fri, 5 Jun 2009 01:51:12 -0400 |
Message-ID: | <f60fe000906042251l235275feib2bd01e16845dda1@mail.gmail.com> |
Subject: | Re: Why bash failed to match this pattern? |
From: | "Mark J. Reed" <markjreed AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
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 |
On Fri, Jun 5, 2009 at 1:10 AM, Pan ruochen wrote: > Hi All, > > My current version of bash on cygwin failed to match this pattern: > ******************************* > target=3Dar > if [[ "$target" =3D~ '^a' ]]; then > =C2=A0 =C2=A0echo Matched > else > =C2=A0 =C2=A0echo Unmatched > fi Not a Cygwin question.; that fails in any bash. The quotes suppress the special meaning of ^ and make it try to match literally. Lose them: if [[ "$target" =3D~ ^a ]]; then ... --=20 Mark J. Reed <markjreed AT gmail DOT com> -- 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 |