bug-bash
[Top][All Lists]
Advanced

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

Re: Bad substitution breaks conditional statement


From: Martin Schulte
Subject: Re: Bad substitution breaks conditional statement
Date: Wed, 14 Oct 2020 05:43:13 +0200

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
> differently from other invalid parameter expansions?

For sure all syntactical errors on parameter expansions should be handled in 
the same way - I suggest they should be considered as fatal errors.

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 by an 
extra semicolon) lead to different behaviour.

Martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]