[Top][All Lists]

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

Re: Bad substitution breaks conditional statement

From: Chet Ramey
Subject: Re: Bad substitution breaks conditional statement
Date: Mon, 12 Oct 2020 09:38:51 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.3.1

On 10/12/20 1:23 AM, Martin Schulte wrote:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-5.0=. 
> -fstack-protector-strong -Wformat -Werror=format-security -Wall 
> -Wno-parentheses -Wno-format-sec$
> uname output: Linux t1 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) 
> x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
> Bash Version: 5.0
> Patch Level: 3
> Release Status: release
> Description:
> It looks as if a bad substitution detected inside a case of if continues the 
> script flow immediately after the conditional statement skipping the 
> remaining statements inside the conditional. Please take a look into section 
> "Repeat-By:".

In general, variable expansion errors cause posix-mode shells to exit and
bash default mode shells to abort execution of the current command and
return to the top level, whether that is the command line or the next
command in the script. This aborts lists and other compound commands.
Bash has always behaved this way.

However, invalid parameter transformation operators are not considered
fatal errors, even in posix mode. Maybe they should be.

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