[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: variable set in exec'ing shell cannot be unset by child shell
From: |
Chet Ramey |
Subject: |
Re: variable set in exec'ing shell cannot be unset by child shell |
Date: |
Mon, 16 Oct 2023 10:34:43 -0400 |
User-agent: |
Mozilla Thunderbird |
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 chet@case.edu http://tiswww.cwru.edu/~chet/
- variable set in exec'ing shell cannot be unset by child shell, Ti Strga, 2023/10/13
- Re: variable set in exec'ing shell cannot be unset by child shell, Dale R. Worley, 2023/10/13
- Re: variable set in exec'ing shell cannot be unset by child shell, Ti Strga, 2023/10/13
- Re: variable set in exec'ing shell cannot be unset by child shell, Greg Wooledge, 2023/10/13
- Re: variable set in exec'ing shell cannot be unset by child shell, Robert Elz, 2023/10/13
- Re: variable set in exec'ing shell cannot be unset by child shell, Robert Elz, 2023/10/14
- Re: variable set in exec'ing shell cannot be unset by child shell, Martin D Kealey, 2023/10/15
- Re: variable set in exec'ing shell cannot be unset by child shell, Chet Ramey, 2023/10/16
Re: variable set in exec'ing shell cannot be unset by child shell, Chet Ramey, 2023/10/13
Re: variable set in exec'ing shell cannot be unset by child shell, Grisha Levit, 2023/10/13