bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nocaseglob and =~


From: Chet Ramey
Subject: Re: nocaseglob and =~
Date: Wed, 5 Aug 2015 09:43:19 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 8/4/15 11:33 PM, isabella parakiss wrote:
> nocaseglob affects regex matching in [[ but according to the man page only
> nocasematch should:
> 
> nocaseglob
>   If set, bash matches filenames in a case-insensitive fashion when
>   performing pathname expansion (see Pathname Expansion above).
> nocasematch
>   If set, bash matches patterns in a case-insensitive fashion when
>   performing matching while executing case or [[ conditional commands.
> 
> 
> I don't know if it'd make sense to have case-insensitive glob matches and
> case-sensitive regexes at the same time...  It may not be that useful and
> even counterintuitive.
> Anyway, it's probably better to either remove glob_ignore_case from line
> 67 in lib/sh/shmatch.c or document the actual behaviour, if intended.

It's intended.  nocaseglob has always affected the behavior of regexp
matching.  The nocasematch variable was introduced over 10 years ago
to decouple the previous behavior, which used nocaseglob and dates back to
when that variable was introduced in bash-3.0.  The request was to have a
variable that allowed case-insensitive matching without tying it to case-
insensitive globbing.  The code still uses `nocaseglob' as well to retain
backwards compatibility.  Maybe it's finally time to change that.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]