Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can I automate "source /etc/profile"?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
MartinB
Apprentice
Apprentice


Joined: 12 Feb 2003
Posts: 222
Location: Apeldoorn, Netherlands

PostPosted: Mon Mar 17, 2003 8:03 am    Post subject: Can I automate "source /etc/profile"? Reply with quote

It's only a minor annoyance, but it's been happening for some time now and I really want it to go away, but can't seem to find any way of doing it.

Okay, when I do anything, except for logging in from the login prompt, I always get a "bash-2.05b$ ". For example, changing users with su, loading aterm's or xterms will always give me this, so I always end up having to type source /etc/profile to get the default Gentoo prompt (The green and blue one).

Is there any way I can make it so that when I load an aterm, or su etc. it will automatically use the prompt and information from profile? This seems to be affecting more than just the prompt, as many programs are unavailable as root until I do a source /etc/profile

Cheers,
Martin
_________________
Intel i7 3820 - 16GB Corsair DDR3 - GeForce GTX 660 2GB - SBLive - 13TB - Gentoo - KDE4
Back to top
View user's profile Send private message
darki
n00b
n00b


Joined: 17 Mar 2003
Posts: 5
Location: Switzerland

PostPosted: Mon Mar 17, 2003 11:44 am    Post subject: Reply with quote

(taken from "man bash"):
by default bash reads:
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile

if the shell is a login shell (eg if you login on a login prompt, or if you do "su -" to su to root)

and
~/.bashrc

if it is no login shell. So a quick hack would be to add a .bashrc to your homedir (and the homedir of root) and put this in it:

Code:

if [ -f /etc/profile ]; then
        . /etc/profile
fi


hope this helps.
Back to top
View user's profile Send private message
Esben
Apprentice
Apprentice


Joined: 29 Jun 2002
Posts: 244
Location: Copenhagen/Denmark

PostPosted: Mon Mar 17, 2003 11:48 am    Post subject: Try man bash Reply with quote

Or do this:

Code:

su
cd
echo 'source /etc/profile' >> .bashrc
su # now it works!


[/code]
_________________
regards, Esben
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war.
Back to top
View user's profile Send private message
rtn
Guru
Guru


Joined: 15 Nov 2002
Posts: 427

PostPosted: Mon Mar 17, 2003 4:04 pm    Post subject: Reply with quote

There are some changes that you can make to your applications that will fix
the problem too.

When you su, use 'su -'.

Code:
/bin/su -


When you open a new xterm, make it a login shell.

Code:
xterm -ls


You can also set this to be default behavor by adding this to your ~/.Xdefaults

Code:
xterm*LoginShell: 1


Does that fix the problem?

--rtn
Back to top
View user's profile Send private message
jazz...
n00b
n00b


Joined: 17 Apr 2002
Posts: 22
Location: Toronto, Canada

PostPosted: Fri May 02, 2003 11:33 pm    Post subject: Reply with quote

rtn:

thanks! you the man.

by creating the .Xdefaults file i now have a perfectly sourced environment all the time.

thank you for helping me get rid of this annoyance :-)

cheers,

jazz...
_________________
Scissors, Rock, Paper... Which one are you gonna choose?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum