I noticed that pure exec bash
command will preserve the environment variables, so you need to use exec -c bash
to run bash in an empty environment.
For example, you login a bash, and export A=1
, if you exec bash
, the A == 1
.
If you exec -cl bash
, A
is empty.
I think this is the best way to do your job.