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

The difference being that the first error occurs during execution, while
the latter occurs during parsing.  The latter is also caught by bash -n.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Reply via email to