[Top][All Lists]

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

Re: inconsistent readonly error behavior

From: Chet Ramey
Subject: Re: inconsistent readonly error behavior
Date: Wed, 23 Dec 2020 09:58:49 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.5.1

On 12/21/20 11:28 PM, Travis Everett wrote:

Bash Version: 5.
0Patch Level: 18
Release Status: release

     While trying to intentionally trap/ignore EXIT in a sourced script, I
noticed that I couldn't keep it from exiting when it tried to overwrite
PATH, which I had set to readonly. When I tried to minimize the repro case,
I realized the behavior seems to differ between simple command and command
list contexts.


     readonly sigh=1

     : reached

This is what POSIX calls a variable assignment error in


A non-interactive POSIX shell is required to exit, and bash running in
posix mode does so. Just about every other shell claiming POSIX conformance
does the same thing, except yash (?).

In default mode, bash jumps back to the top level and reads a new command,
aborting whatever command is currently executing, even if it's a compound

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