View previous topic :: View next topic |
Author |
Message |
MartinB Apprentice
Joined: 12 Feb 2003 Posts: 222 Location: Apeldoorn, Netherlands
|
Posted: Mon Mar 17, 2003 8:03 am Post subject: Can I automate "source /etc/profile"? |
|
|
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 |
|
|
darki n00b
Joined: 17 Mar 2003 Posts: 5 Location: Switzerland
|
Posted: Mon Mar 17, 2003 11:44 am Post subject: |
|
|
(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 |
|
|
Esben Apprentice
Joined: 29 Jun 2002 Posts: 244 Location: Copenhagen/Denmark
|
Posted: Mon Mar 17, 2003 11:48 am Post subject: Try man bash |
|
|
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 |
|
|
rtn Guru
Joined: 15 Nov 2002 Posts: 427
|
Posted: Mon Mar 17, 2003 4:04 pm Post subject: |
|
|
There are some changes that you can make to your applications that will fix
the problem too.
When you su, use 'su -'.
When you open a new xterm, make it a login shell.
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 |
|
|
jazz... n00b
Joined: 17 Apr 2002 Posts: 22 Location: Toronto, Canada
|
Posted: Fri May 02, 2003 11:33 pm Post subject: |
|
|
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 |
|
|
|