On 2/23/21 7:54 AM, Léa Gris wrote:
https://ideone.com/iw2pSv

#!/usr/bin/env bash

declare -r r

r=2 || exit 2

OK, let's pick this one. This is what POSIX calls a "variable assignment
error" in

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_01

(you've omitted the error messages bash prints).

POSIX says a non-interactive shell must exit, which bash does in posix mode. An interactive shell doesn't exit, but POSIX says

"the shell shall not perform any further processing of the command in which the error occurred."

That command is the and-or list the shell is executing; the shell jumps
back to the top-level processing loop. Bash does this in interactive and
non-interactive shells in default mode.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to