On 1/28/19 6:24 PM, Martijn Dekker wrote: > Op 27-01-19 om 22:59 schreef Chet Ramey: >> This is a consequence of a combination of two POSIX features. First, POSIX >> requires assignment statements preceding special builtins to create global >> variables (POSIX has no local variables) that persist in the shell context >> after the special builtin completes. > > Exactly because POSIX has no notion of local variables (but bash does), > I don't think there is anything that requires you to ignore/override > bash local variables in this context. Any fully POSIX-compliant script > will not use local variables, so is not affected either way. I think > that leaves you free to do the logical thing and keep the scope local as > defined by the user.
Yes, I think so. This isn't how the discussion from back in May ended up, but I think I will change the posix-mode behavior for the next release. The default bash behavior will stay the same -- having assignments that precede a special builtin persist past its execution is not something we need to carry forward. -- ``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/