[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
recovering from parser errors during compound assignment
From: |
Grisha Levit |
Subject: |
recovering from parser errors during compound assignment |
Date: |
Wed, 26 Apr 2023 17:27:34 -0400 |
If a parser error is encountered when `local' is parsing an array
assignment string, the installed unwind-protects never run:
$ f() { local -a a='(())'; }; f
bash: syntax error near unexpected token `('
$ declare -p a FUNCNAME
declare -a a
declare -a FUNCNAME=([0]="f")
----
If there's a PROMPT_COMMAND set and a parser error is encountered during a
compound assignment, the alias expansion state is not properly restored:
$ PROMPT_COMMAND=:; alias A=:
$ declare a=(())
bash: syntax error near unexpected token `('
$ A
bash: A: command not found
- recovering from parser errors during compound assignment,
Grisha Levit <=