Re: Bad substitution breaks conditional statement

2020-10-14 Thread Chet Ramey
On 10/13/20 11:43 PM, Martin Schulte wrote: > Consider the following script: > > #!/bin/bash > > echo "${x;:-}" ; echo "Not executed" > echo "Executed" > > echo "${x:-}" ;; echo "Not executed" > echo "Not executed" > <<< > > It just a source of problems that the two syntactical errors (bo

Re: Bad substitution breaks conditional statement

2020-10-14 Thread Chet Ramey
On 10/13/20 4:42 PM, Martin Schulte wrote: > Hi Chet, hi all! > >> 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

Re: Bad substitution breaks conditional statement

2020-10-14 Thread Andreas Schwab
On Okt 14 2020, Martin Schulte wrote: > Consider the following script: > > #!/bin/bash > > echo "${x;:-}" ; echo "Not executed" > echo "Executed" > > echo "${x:-}" ;; echo "Not executed" > echo "Not executed" > <<< > > It just a source of problems that the two syntactical errors (both caused

Re: Bad substitution breaks conditional statement

2020-10-13 Thread Martin Schulte
Hello Lawrence, hello *! > >> However, invalid parameter transformation operators are not considered > >> fatal errors, even in posix mode. Maybe they should be. > > > > Yes, please :-) > > > > Or no error at all. > > Why should invalid parameter transformation operators be treated > differentl

Re: Bad substitution breaks conditional statement

2020-10-13 Thread Lawrence Velázquez
> On Oct 13, 2020, at 4:42 PM, Martin Schulte wrote: > > Hi Chet, hi all! > >> 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 n

Re: Bad substitution breaks conditional statement

2020-10-13 Thread Martin Schulte
Hi Chet, hi all! > 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 compoun

Re: Bad substitution breaks conditional statement

2020-10-12 Thread Chet Ramey
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

Re: Bad substitution breaks conditional statement

2020-10-12 Thread Chris Elvidge
On 12/10/2020 06: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-1

Re: Bad substitution breaks conditional statement

2020-10-12 Thread Lawrence Velázquez
> On Oct 12, 2020, at 1:23 AM, Martin Schulte wrote: > > 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-