delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/24/17:30:05

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-06.arcor-online.net 7789339A4C0
Message-ID: <4B0C5DC5.7070000@arcor.de>
Date: Tue, 24 Nov 2009 23:27:17 +0100
From: Dirk Fassbender <dirk DOT fassbender AT arcor DOT de>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin bash regexp matching doesn't treat "\b" properly
References: <26500158 DOT post AT talk DOT nabble DOT com> <26500814 DOT post AT talk DOT nabble DOT com> <4B0C4C2A DOT 3080502 AT gmail DOT com> <26503748 DOT post AT talk DOT nabble DOT com> <408995400911241354p27f2c5eek94973673d24fa3b3 AT mail DOT gmail DOT com> <26504147 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <26504147.post@talk.nabble.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

aputerguy schrieb:
> Hugh Myers:
>   
>> This might come across as slightly smart-assed, but if you wrote your
>> script in Perl, you wouldn't have the platform problem, nor the
>>  word-boundary problem. True you would have a Perl problem, but that
>> would still be several orders of magnitude easier than trying to have
>> Linux, Cygwin and Posix come to agreement!! :)
>>     
>
> As soon as Perl becomes the default shell...
>
> Seriously, there are times to use Perl and times not to...
> But launching perl seems a bit of overkill when I just have to do a simple
> match in a .bashrc script or when I need a small shell script wrapper.
>
>   
Perhaps it is an option to use the "extglob shell option" of the bash 
shell in the script.
Then you can use a  pattern-list  in the statement. Something like
  [[ ${foo} = @(bar|${foo}|sds) ]]
You have to build the pattern-list in a little bit different way, 
because of the separator "|".

This works in ksh and bash ;-)
I use this on AIX, HP-UX, Solaris, Linux and Cygwin with bash and KSH.

Dirk



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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