Peng Yu wrote:
> I'm wondering how to start bash without inheriting any environment
> variables and user level profiles (such as .bash_profile). Would you
> please let me know what option to use?

At login time only a bare minimum of environment variables exist.  It
is already almost a minimal set.  What would you avoid?

There may be a better way.  But for me I would place the following in
the ~/.bash_profile.  The env -i will initialize it to an empty
environment and only the explicitly set variables will exist.

  exec env -i PATH=$PATH HOME=$HOME bash

But beware, I did not test this and mistakes in your .bash_profile may
prevent bash from starting and thereby preventing you from logging
into the system.  You could lock yourself out.  Always keep a spare
login handy in order to fix problems.

Bob


Reply via email to