bug-bash
[Top][All Lists]
Advanced

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

Re: select syntax violates the POLA


From: Chet Ramey
Subject: Re: select syntax violates the POLA
Date: Thu, 1 Apr 2021 11:57:24 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0

On 4/1/21 4:36 AM, greywolf@starwolf.com wrote:

Bash Version: 5.1
Patch Level: 4
Release Status: release

Description:
        The 'select' directive's syntax does not correspond to the rest of the 
shell's syntax.
        I am not sure if this is by design; if it is, let me know and I'll go 
away.

It's more like `select' doesn't inherit some of the shell's special cases.

        if ((n > 1)); then {
            select dir in ${d[@]}; do {
                break;
            } done;
        }
        else { ...

...but select breaks on the "} done;" syntax

Yes, you need a list terminator so that `done' is recognized as a reserved
word here. `;' is sufficient. Select doesn't allow the `done' unless it's
in a command position. Some of the other compound commands have special
cases, mostly inherited from the Bourne shell, to allow it.

--
``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]