I want to run a program in an empty environment (i.e. with no envariables set). How to do this in bash?
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.