Unix Technical Forum

PATH takes no effect when login

This is a discussion on PATH takes no effect when login within the Linux Operating System forums, part of the Unix Operating Systems category; --> I am trying to set the path in with adding lines in .bash_profile if [ -f ~/.bashrc ]; then ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 07:15 AM
Sheep
 
Posts: n/a
Default PATH takes no effect when login

I am trying to set the path in with adding lines in .bash_profile

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
if [ -f ~/test.env ]; then
~/test.env
fi
PATH=$PATH:$HOME/bin
export PATH

Where test.env contains just a few of lines,

export TOOLCHAIN_PATH=/1234567
export PATH=${TOOLCHAIN_PATH}/bin:$PATH
echo PATH=${PATH}

The last line in test.env is to make sure the desired path is added in
every login. Actually, I got what I want when login as following text
is shown
PATH=/1234567/bin:/user/kerberos/bin:/user/local/bin:/bin:/usr/bin

However, when the prompt comes up, I type "set" to further check,
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/shane/bin

Originally, the system work fine with the setting. I don't what
changes that sucks the system.

Can anyone give me some clues on this problem?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 07:15 AM
Martin Klar
 
Posts: n/a
Default Re: PATH takes no effect when login

Sheep wrote:
> I am trying to set the path in with adding lines in .bash_profile
>
> if [ -f ~/.bashrc ]; then
> . ~/.bashrc
> fi
> if [ -f ~/test.env ]; then
> ~/test.env
> fi


maybe a
source ~/test.env
fix your problem.

"man bash":
source filename [arguments]
Read and execute commands from filename in the current shell environment
....Â*


HTH Martin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 07:15 AM
The Wizard of Oz
 
Posts: n/a
Default Re: PATH takes no effect when login

Sheep wrote:
> I am trying to set the path in with adding lines in .bash_profile
>
> if [ -f ~/.bashrc ]; then
> . ~/.bashrc
> fi
> if [ -f ~/test.env ]; then
> ~/test.env
> fi
> PATH=$PATH:$HOME/bin
> export PATH
>
> Where test.env contains just a few of lines,
>
> export TOOLCHAIN_PATH=/1234567
> export PATH=${TOOLCHAIN_PATH}/bin:$PATH
> echo PATH=${PATH}
>
> The last line in test.env is to make sure the desired path is added in
> every login. Actually, I got what I want when login as following text
> is shown
> PATH=/1234567/bin:/user/kerberos/bin:/user/local/bin:/bin:/usr/bin
>
> However, when the prompt comes up, I type "set" to further check,
> PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/shane/bin
>
> Originally, the system work fine with the setting. I don't what
> changes that sucks the system.
>
> Can anyone give me some clues on this problem?


Here is a possible solution...

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/opt/schily/bin:/usr/local/lib:./

export PATH
unset USERNAME
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 07:15 AM
Daniel Ganek
 
Posts: n/a
Default Re: PATH takes no effect when login

Sheep wrote:
> I am trying to set the path in with adding lines in .bash_profile
>
> if [ -f ~/.bashrc ]; then
> . ~/.bashrc
> fi
> if [ -f ~/test.env ]; then
> ~/test.env
> fi
> PATH=$PATH:$HOME/bin
> export PATH
>
> Where test.env contains just a few of lines,
>
> export TOOLCHAIN_PATH=/1234567
> export PATH=${TOOLCHAIN_PATH}/bin:$PATH
> echo PATH=${PATH}
>
> The last line in test.env is to make sure the desired path is added in
> every login. Actually, I got what I want when login as following text
> is shown
> PATH=/1234567/bin:/user/kerberos/bin:/user/local/bin:/bin:/usr/bin
>
> However, when the prompt comes up, I type "set" to further check,
> PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/shane/bin
>
> Originally, the system work fine with the setting. I don't what
> changes that sucks the system.
>
> Can anyone give me some clues on this problem?


You're executing ~/test.env not sourcing it. Change the line to

. ~/test.env

/dan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:48 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com