bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to start bash without inheriting any environment variables and u


From: Bob Proulx
Subject: Re: How to start bash without inheriting any environment variables and user level profiles (such as .bash_profile)?
Date: Wed, 28 Apr 2010 15:03:13 -0600
User-agent: Mutt/1.5.18 (2008-05-17)

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

[Prev in Thread] Current Thread [Next in Thread]