[Gllug] Defining an enviromnet variable in Gnome (Ubuntu)

Bruce Richardson itsbruce at workshy.org
Wed Jun 18 11:32:09 UTC 2008


On Wed, Jun 18, 2008 at 03:18:52AM +0100, Andrew wrote:
> I want to define environment variables and have them available in any 
> terminal window (and SSH sessions).  I have rpeviously done this by 
> adding the command to .bash_profile.  However this does not appear to 
> get called when starting an session with gnome.

.bash_profile will be used if you login at the console.  In contrast,
.bashrc is read if you run an interactive shell that isn't a login
shell, as is the case with xterms.  This means that you can have
a different environment if you logged in at the console and ran startx
as opposed to logging in via xdm (gdm/kdm/whatever).

Debian solves this problem by having their default .bash_profile call
.bashrc and otherwise only using the former file for those things which
really do need to be set differently for a login.  If your distribution
of choice doesn't do this, or if you spun up your own .bash_profile from
scratch, then I recommend this solution.

if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

-- 
Bruce

I unfortunately do not know how to turn cheese into gold.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20080618/ad51bb9a/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list