On 2022/01/22 12:48, Andreas Kusalananda Kähäri wrote:
The shell even keeps the PS1 variable's value from its inherited
environment
without sanitizing it.
----
This is a requirement of the unix/posix model that has 'fork'
create a new process that is a new unfiltered, unsanitized copy of the
original.
All memory, not just environment vars are exact copies of the
parent.
If a child process did not contain an exact copy of its parent after
a fork, it would be a serious problem.
What you are insinuating as a problem "the shell even keeps the PS1
variable's value from its inherited environment without sanitizing it",
is a requirement not just for PS1, but all memory.
If you don't like that feature, you move to an entirely different
OS -- like 'NT' (at base of windows), where new processes are created
by a special OS-function that has no automatic importation of anything
from the previous process. Everything is created 'anew' with nothing
in the new process being automatically inherited from the previous process.
If a shell or any process didn't inherit it's parent's memory, it would be
a serious error.