bug-bash
[Top][All Lists]
Advanced

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

Re: case statement: wrong behaviour of the ";;&" operator


From: Chet Ramey
Subject: Re: case statement: wrong behaviour of the ";;&" operator
Date: Sun, 27 Jan 2019 17:42:46 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3

On 1/26/19 12:30 AM, Norman Krebs wrote:

> Bash Version: 5.0
> Patch Level: 2
> Release Status: release
> 
> Description:
> 
>     "echo x" shouldn't be executed here, but it gets:
> 
>     case "1" in
>         1) : ;;&
>         2) : ;;
>         *) echo x ;;
>     esac
> 
>     Following the man page, the ';;&' operator should cause testing the _next_
>     pattern: '2)' only and not _all_ following patterns.

Well, it should have "as if the pattern list had not matched." at the end
there. The idea is that you move to the next pattern list and continue
executing the command. It's a way to have multiple patterns match if you
want to do that. It's not a frequently-used feature, it seems.

Chet
-- 
``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/



reply via email to

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