Hi Stephen,

Am Samstag, 25. Oktober 2003 19:06 schrieb Stephen Liu:

> On KDE Konsole window
>
> As ROOT, it prompts
> mymachine root #
>
> not as
> [EMAIL PROTECTED] root]#
>
>
> As USER
> bash-2.05b$      the bash version, not as
>
> [EMAIL PROTECTED] satimis]$
>
> Kindly advise how to change them back


Yes, yes, this IS a problem on gentoo. Let's examine the startup 
files, assuming you are using kdm and kde3.1. The first question 
is: what does kdm start after logging in?

---code
$ grep "^Session=" /usr/kde/3.1/share/config/kdm/kdmrc
Session=/etc/X11/xdm/Xsession
---

This is the file that is invoked as user by kdm after login. Let's 
check the first line:

---code
$ head -1 /etc/X11/xdm/Xsession
#!/bin/bash --login
---

You see, "bash" is invoked as login shell. The first sourced file is 
"/etc/profile". After reading that file, it looks for 
"~/.bash_profile", "~/.bash_login", and "~/.profile", in that 
order, and reads and executes commands only from the first one that 
exists and is readable (-> man bash). When you have chosen to start 
kde3.1, the next file which gets invoked is 
/usr/kde/3.1/bin/startkde (have a look in /etc/X11/xdm/Xsession).

---code
$ head -1 /usr/kde/3.1/bin/startkde
#!/bin/sh --login
$ ls -l /bin/sh
lrwxrwxrwx  1 root   root   4 2003-09-30 10:16 /bin/sh -> bash
---

Now "bash" is invoked as "sh" and as login shell, too. So the 
sourced files are "/etc/profile" and "~/.profile" only, in that 
order (-> man bash).

The last thing you do is starting "konsole" as terminal with your 
login shell, assuming to be "bash", but it is not invoked as login 
shell, so it sources only the file "~/.bashrc".

On a fresh installed gentoo, you have "~/.bash_profile" and 
"~/.bashrc" in the users' home directories ($ ls -a /etc/skel).

So the files are sourced in this order:

/etc/profile (by Xsession), ~/.bash_profile (by Xsession), 
/etc/profile (by startkde), ~/.bashrc (by konsole)

You are interested in PS1 for setting your command prompt. This is 
set in /etc/profile, but it checks for a !dumb terminal, but bash 
has always been invoked as dumb terminal. So all you have to do is 
to change both lines

---listing /etc/profile 
if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]
---

to

---listing /etc/profile
if [ -n "$BASH" ]
---

Maybe you should also remove "--login" from the shebang line in 
/usr/kde/3.1/bin/startkde, because whenever kde starts, the 
invoking user is already logged in. In X this should be done by 
Xsession. The login profiles are to be sourced only one time.

I hope this makes the kde startup a little bit clearer.

Kai



--
[EMAIL PROTECTED] mailing list

Reply via email to