On 10/14/23 12:46 AM, Martin D Kealey wrote:

Respectfully I must disagree.

This aspect of Bash's behaviour has a very long historical precedent.

Back when I used the Bourne Shell we didn't have `local`, so we used to
write `var= func` to make sure that `func` couldn't mess with *our* `var`.

This is a POSIX special builtin, so the desire for a local variable is the
same, but with a special twist that makes it not work. In that case, the
variable assignment is required to propagate to the shell global variable
table, as if

VAR=outside . filename

were

VAR=outside; . filename

That isn't the same with a non-special builtin like `alias'.

Bash doesn't treat the so-called special builtins any differently unless
it's in posix mode.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/


Reply via email to