[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Confused by =~ behavior with regards to quoting
From: |
Chet Ramey |
Subject: |
Re: [Help-bash] Confused by =~ behavior with regards to quoting |
Date: |
Fri, 17 Oct 2014 10:27:16 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
On 10/17/14, 9:44 AM, Greg Wooledge wrote:
> [[ $1 = +([0-9]) ]]
>
> And you don't even have to enable extglob here -- for some reason,
> even with extglob disabled, this particular case *still* works.
Since the [[ command is defined to use extended globbing for the =
operator, bash enables it unconditionally while executing matches.
It's for compatibility with other shells that implement [[.
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/