I want to run a program in an empty environment (i.e. with no envariables set). How to do this in bash?
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
|
You can do this with
Contrary to comments below, this does completely clear out the environment, but it does not prevent You can check this with:
I.e. wipe the environment and then print it. The output will be blank. |
|||||||||||
|
|
A lot of programs rely on some important environment variables, so you may want to retain them:
Alternatively, you could log in into a small login-time environment.
|
|||
|
|
