LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-18-2007, 05:35 PM   #1
hradtke
Member
 
Registered: May 2006
Distribution: Fedora Core 6
Posts: 38

Rep: Reputation: 15
Angry export line in .bash_profile causing weird environment issues in gome


I have the following in my .bash_profile:

Code:
#
.bash_profile
                                                                                               
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
                                                                                               
# User specific environment and startup programs
                                                                                               
PATH=$PATH:$HOME/bin:/usr/local/bin
                                                                                               
export PATH
unset USERNAME
                                                                                               
# Default release
release=500
echo -n "Release Level $release?: "
read release
                                                                                               
if [ -z $release ]
then
        release=500
fi
                                                                                               
export HOME=$HOME/$release
cd $HOME
The idea is that I have different release levels under my home directory.
Examples:
/home/hradtke/500
/home/hradtke/490

This script works fine if I first login to root and do a 'su - hradtke' or if I login to the command line directly. However, if I login to gnome and open terminal the .bash_profile never gets called. The culprit seems to be:
Code:
export HOME=$HOME/$release
If I remove that line then logging into gnome and opening terminal it does get called. More specifically, it appears that the HOME= statement is causing it to barf.

Any ideas about what might be going on here? Could it be tied to Xauthority in any way? Are the errors logging anywhere? I cannot seem to find anything.

Running RHEL3 (I know, I know, upgrading to 5 soon).

Thanks.

Last edited by hradtke; 05-18-2007 at 05:49 PM.
 
Old 05-18-2007, 08:59 PM   #2
mechdave
Member
 
Registered: Apr 2007
Location: Adelaide, Australia
Distribution: Ubuntu 8.10 and 7.10 server
Posts: 95

Rep: Reputation: 15
Code:
#
.bash_profile
should look like this:
Code:
#.bash_profile
To make it all work you need to add a conditional statement to make a directory according to what release you want to use as $HOME.
Then it should all work (I think, unless I am missing something!)
 
Old 05-19-2007, 09:44 AM   #3
hradtke
Member
 
Registered: May 2006
Distribution: Fedora Core 6
Posts: 38

Original Poster
Rep: Reputation: 15
Hi mechdave,
The error you mentioned was probably a pasting error. Thanks for the help though.

I finally figured it out. I was not aware that gnome processed the .bash_profile file when you logged into gnome. The following statement was messing things up:

Code:
if [ -z $release ]
then
        release=500
fi
That would force the release to be 500 when I logged into gnome. Then the next statement would change my home directory:
Code:
export HOME=$HOME/$release
When I opened terminal, it would be looking for a .bash_profile in the new home directory ($HOME/500). Thus, it would not find the .bash_profile and not work anymore. Removing that if statement made things work perfectly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to export environment variable from a bash script dimaash Linux - Newbie 20 08-09-2011 07:12 AM
export - Invalid identifier for environment variable ryan.greenwood Linux - Desktop 2 05-27-2007 10:22 PM
Why I can't see environment variables from .bash_profile vori1973 Linux - General 3 10-25-2006 01:22 AM
Weird Desktop Environment Issues Damo2k Debian 11 10-02-2006 07:43 AM
really easy question: why won't my environment variables export digitized_funk Linux - Newbie 3 10-22-2003 05:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration