Date: Mon, 14 Jul 2025 15:22:35 -0400
From: Chet Ramey <[email protected]>
Message-ID: <[email protected]>
| Say you have something like
|
| if command; then
| declare -i X
| X=some-random-expression
| fi
|
| How does the parser determine the assignment should be parsed as an
| arithmetic expression?
There is a much better example of the problem:
func() {
if eval "$1"; then
declare -i X=something
else
unset X
fi
X=whatever-you-like
}
Now work out how to parse things in a context dependent way.
What's more, all this needs to work, and to be consistent, and
logical for the user to understand.
And note that "whatever..." may contain any kind of expansion,
including $(( )) any kind of var reference, including to $X, including
using that as an index into some kind of array.
kre