View previous topic :: View next topic |
Author |
Message |
xTango n00b
Joined: 11 Jun 2002 Posts: 15 Location: Argentina
|
Posted: Fri Jul 05, 2002 7:40 pm Post subject: Console and profile |
|
|
Hi,
I guess this kind of newbie questions have been asked a trillion times, but I still don't get it and I can't find anything in the docs.
Problem: My KConsole (KDE 3.0.2) desn't read the profile.
.bashrc:
source /etc/profile
.bash_profile:
eval `dircolors -b /etc/DIR_COLORS`
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls --color -l"
source /etc/profile
I changed the first line of startkde to #!/bin/sh -login
and my .xinitrc is calling startkde instead of kde.
Oh! And I configured KConsole to run "bash -ls" instead of plain "bash".
And I still don't get my aliases (which are defined /etc/profile).
Can someone with a little patience explain why isn't bash reading my .bash_profile?
Thanks in advance. |
|
Back to top |
|
|
Black666 n00b
Joined: 15 Jul 2002 Posts: 61 Location: Vienna (Austria)
|
Posted: Thu Jul 25, 2002 8:16 am Post subject: |
|
|
You should put this
Code: |
eval `dircolors -b /etc/DIR_COLORS`
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls --color -l"
|
into your /etc/profile
As far as I know KDE reads the .bashrc and not the .bash_profile... |
|
Back to top |
|
|
nitro322 Guru
Joined: 24 Jul 2002 Posts: 594 Location: USA
|
Posted: Thu Jul 25, 2002 12:06 pm Post subject: |
|
|
hmm... After reading this post, I just realized that I having the same problem. I also have a custom path and a couple other things being set through ~/.bash_profile, which I definately don want global. I guess putting them in ~/.bashrc would work, but that seems like kind of a kludge workaround. Anyone know where the actual problem comes from? I've never seen this before. Thanks. |
|
Back to top |
|
|
Naan Yaar Bodhisattva
Joined: 27 Jun 2002 Posts: 1549
|
Posted: Thu Jul 25, 2002 1:05 pm Post subject: |
|
|
When started as 'sh', bash does not read the .bash_profile file AFAIK. If you change the start up to "#!/bin/bash --login".
Also, bash does not have a "-ls" option. |
|
Back to top |
|
|
nitro322 Guru
Joined: 24 Jul 2002 Posts: 594 Location: USA
|
Posted: Fri Jul 26, 2002 12:05 am Post subject: |
|
|
ok, noticed something else strange. When I initially pull up a konsole, my .bash_profle (or .profile) is not read. However, if I su - my username and login again (same account), it's processed. I tried changing startkde from #!/bin/sh --login to #!/bin/bash --login, as previously suggested, but that didn't help. Anyone find a fix for this? Thanks. |
|
Back to top |
|
|
reverius42 Apprentice
Joined: 16 Jul 2002 Posts: 166 Location: Tucson, AZ
|
Posted: Fri Jul 26, 2002 12:08 am Post subject: .bash_profile and KDE |
|
|
nitro322 wrote: | ok, noticed something else strange. When I initially pull up a konsole, my .bash_profle (or .profile) is not read. However, if I su - my username and login again (same account), it's processed. I tried changing startkde from #!/bin/sh --login to #!/bin/bash --login, as previously suggested, but that didn't help. Anyone find a fix for this? Thanks. |
As someone stated earlier, KDE reads from the .bashrc instead of .bash_profile. Although, I thought in a normal installation .bashrc reads from .bash_profile... or maybe not.
Try putting the contents of .bash_profile (that you want, anyway) in .bashrc, and then if that doesn't work, in /etc/profile. _________________ Even a stopped clock gives the right time twice a day. |
|
Back to top |
|
|
nitro322 Guru
Joined: 24 Jul 2002 Posts: 594 Location: USA
|
Posted: Fri Jul 26, 2002 12:47 am Post subject: |
|
|
I was hesitant about doing that because everything else reads .bash_profile first, which then calls .bashrc. I didn't want things like my PATH being set twice and either adding multiple entries or overiding some. Turns out though that this didn't work quite right either becuase /etc/profile isn't read either.
However, sburnett was kind enough to provide the solution (although he accidently started a new thread, which got moved to /dev/null). Simply call konsole with the -ls, and it works fine. Update your shortcuts and you're all set. |
|
Back to top |
|
|
xTango n00b
Joined: 11 Jun 2002 Posts: 15 Location: Argentina
|
Posted: Fri Jul 26, 2002 7:51 pm Post subject: |
|
|
Here:
AFAIK, bash will read .bashrc for non-login shells, and .bash_profile for login shells. So, I put "source /etc/profile" in both .bashrc and .bash_profile and then put everything I need in /etc/profile. This way, _every_ shell should parse /etc/profile. But still they don't. Having Kconsole call bash -ls or bash --login doesn't help.
I just don't get it... |
|
Back to top |
|
|
Naan Yaar Bodhisattva
Joined: 27 Jun 2002 Posts: 1549
|
Posted: Fri Jul 26, 2002 8:23 pm Post subject: |
|
|
The solution that nitro322 was suggesting above is to change the konsole "shortcut" on kicker or elsewhere to be: "konsole -ls" (at least as I read it).
xTango wrote: | Here:
AFAIK, bash will read .bashrc for non-login shells, and .bash_profile for login shells. So, I put "source /etc/profile" in both .bashrc and .bash_profile and then put everything I need in /etc/profile. This way, _every_ shell should parse /etc/profile. But still they don't. Having Kconsole call bash -ls or bash --login doesn't help.
I just don't get it... |
|
|
Back to top |
|
|
nitro322 Guru
Joined: 24 Jul 2002 Posts: 594 Location: USA
|
Posted: Fri Jul 26, 2002 10:10 pm Post subject: |
|
|
Naan Yaar wrote: | The solution that nitro322 was suggesting above is to change the konsole "shortcut" on kicker or elsewhere to be: "konsole -ls" (at least as I read it). |
Yes, that's correct. An easy way to test it is to just hit <Alt>-<F2> to bring up the Run box, and then type in 'konsole -ls' (without quotes) and hit enter. Should work for you... |
|
Back to top |
|
|
daen n00b
Joined: 31 Jul 2002 Posts: 18
|
Posted: Sun Sep 15, 2002 11:57 am Post subject: Re: Console and profile |
|
|
i had the same problem - and i solved it "the right way" (tm) )
it's been an annyoing error that the midnight commander wasn't able to show output on the text console as a normal user but as root. so i diffed SET and saw that root has a /bin/bash and my user /bin/sh.
when i added my user with useradd i left the shell option blank. so i added at /etc/passwd /bin/bash to my user and now everything works perfectly.
bye,
daniel
xTango wrote: | Hi,
I guess this kind of newbie questions have been asked a trillion times, but I still don't get it and I can't find anything in the docs.
Problem: My KConsole (KDE 3.0.2) desn't read the profile.
.bashrc:
source /etc/profile
.bash_profile:
eval `dircolors -b /etc/DIR_COLORS`
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls --color -l"
source /etc/profile
I changed the first line of startkde to #!/bin/sh -login
and my .xinitrc is calling startkde instead of kde.
Oh! And I configured KConsole to run "bash -ls" instead of plain "bash".
And I still don't get my aliases (which are defined /etc/profile).
Can someone with a little patience explain why isn't bash reading my .bash_profile?
Thanks in advance. |
|
|
Back to top |
|
|
splakdatter n00b
Joined: 09 Jul 2002 Posts: 28 Location: Stroop, NL
|
Posted: Sat Sep 21, 2002 1:36 am Post subject: |
|
|
konsole -ls works for the user, but go into superuser mode a la "su" and you lose all the aliases and other setting in /etc/profile.
Solve that one perty pleez.
Naan Yaar wrote: | The solution that nitro322 was suggesting above is to change the konsole "shortcut" on kicker or elsewhere to be: "konsole -ls" (at least as I read it).
xTango wrote: | Here:
AFAIK, bash will read .bashrc for non-login shells, and .bash_profile for login shells. So, I put "source /etc/profile" in both .bashrc and .bash_profile and then put everything I need in /etc/profile. This way, _every_ shell should parse /etc/profile. But still they don't. Having Kconsole call bash -ls or bash --login doesn't help.
I just don't get it... |
|
|
|
Back to top |
|
|
Naan Yaar Bodhisattva
Joined: 27 Jun 2002 Posts: 1549
|
Posted: Sat Sep 21, 2002 3:59 am Post subject: |
|
|
The short answer is: do "su -" instead of "su".
The long answer is:
- Put your global aliases in /etc/bashrc (this file does not exist in gentoo)
- Put something like this in your .bashrc:
Code: |
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
|
Put something like this in your .bash_profile:
Code: |
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
|
This will allow you to have global aliases that work whether you are in a login or in a non-login shell.
splakdatter wrote: | konsole -ls works for the user, but go into superuser mode a la "su" and you lose all the aliases and other setting in /etc/profile.
Solve that one perty pleez.
... |
|
|
Back to top |
|
|
|