[Toybox] So why does local support += then?
Rob Landley
rob at landley.net
Sat Aug 22 20:58:06 UTC 2026
func() { local PP+=abc; echo $PP; }; PP=123; func; echo $PP
I went and implemented "123abc\n123\n" as the output, but then TEST_HOST
failed because that's not what bash actually does ("abc\n123\n").
$ abc=123; export abc+=def; echo $abc
123def
Is there a rationale here? (The local is created empty, and then the
_empty_ one is appended to? Why accept the append syntax...?)
Rob
P.S. It's all corner cases. If I "unset abc=123" it doesn't affect the
value of abc because unset just uses the whole unverified string as a
name and treats "not there" as a success, so it's not ACTUALLY
supporting assignment syntax, it just doesn't complain...
More information about the Toybox
mailing list