[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: case $var in $list) issue
From: |
#!microsuxx |
Subject: |
Re: case $var in $list) issue |
Date: |
Fri, 1 Nov 2024 16:37:59 +0100 |
On Fri, Nov 1, 2024, 15:49 Chet Ramey <chet.ramey@case.edu> wrote:
> On 11/1/24 7:15 AM, Greg Wooledge wrote:
> > On Fri, Nov 01, 2024 at 06:00:49 +0100, #!microsuxx wrote:
> >> shopt -s extglob
> >> m='@(a|b)' ; case b in $m) echo ye ; esac
> >> ye
> >
> > Huh, interesting indeed.
>
> It's really not.
>
>
> > hobbit:~$ shopt -s extglob
> > hobbit:~$ m='a|b'
> > hobbit:~$ case b in $m) echo ye ; esac
> > hobbit:~$ m='@(a|b)'
> > hobbit:~$ case b in $m) echo ye ; esac
> > ye
> >
> > I can only speculate that it sometimes re-parses the contents of $m
> > based on the first character.
>
> The case statement has a pattern list with a single element, $m, which
> expands to a single unquoted extglob pattern, @(a|b).
>
> The case statement tries to match b against that pattern, and, since
> extglob is enabled, it matches.
>
very good !!
greets ..
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
>
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, Greg Wooledge, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01