Jump to content

Command line prompt


Recommended Posts

In my Mandrake terminal, I have the user and directory info:

dan@gamer#dan

if I am in the /home/dan directory. But in gentoo, I have

bash-2.05b#

irregardless of where I am. I can't even tell if I left terminal in superuser mode. How do I cahnge gentoo to match Mandrake?

Link to comment
Share on other sites

try doing this

source /etc/profile

 

or to automate it ... try running xterm -ls (login shell)

I use Eterm ... and in the configuration of Eterm I ticked the box that said Enable login Shell (or something like that)

Link to comment
Share on other sites

Thanks, Paul, that works for the session. The xterm thing doesn't do it, so I'll have to figure out where my gentoo terminal configuration is.

Link to comment
Share on other sites

actually tyme is right ...

but for some reason I could never get my .bashrc to load :-|

 

do man xterm and find out what the params is for login shell

 

the terminal I found that doesn't have a login params is konsole

Link to comment
Share on other sites

I did something wrong. I put the line in ~/.bashrc and lost all function in terminal. I had to go to root and remove the change. Are you sure about the instructions?

Link to comment
Share on other sites

the example .bashrc i was talking about is in /etc/skel/

 

i have no problem with my ~/.bashrc on my gentoo system....are you sure what you added to your file was valid?

 

p.s.-for some info on this and various links regarding making your own prompt see this thead

Link to comment
Share on other sites

I'm sure it works, but not exactly what the sum of it means as far as priority. Meaning, I think you're basically saying 'anything in .bash_profile overrides anything in .bashrc'. I'm sure the man or info pages say. I had the same prob in LFS and had to edit from init 1. I basically just #commented stuff out of .bash_profile.

Link to comment
Share on other sites

I'm not sure what is the problem here.

 

A login shell sources .profile (or .bash_profile)

 

A non login shell sources .bashrc

 

 

So depending on what kind of bash session you are you'll have one or another environment. Then depends on the user to have the *same* environment always. Since a non login shell inherits its environment from its parent shell, in theory you have nothing to do. The difference is with login shells which unless you put it they won't read and execute the settings on ~/.bashrc (Mandrake does it by default, but other distros don't). The usual solution is to add some thing like this in your .profile or .bash_profile (depending on what you have):

[ -f ~/.bashrc ] && . ~/.bashrc

 

This is how bash read (in interactive sessions) its config files (and that depends only on bash, not on the distro):

 

Login shell First, reads and executes commands from /etc/profile; then looks for users's ~/.bash_profile, ~/.bash_login, OR ~/.profile; in that order, and only reads and executes the code of the first one found.

 

Non Login shell: (ie a subshell; for example a non-login xterm). It reads and executes commands from users ~/.bashrc

 

So if you want the same behaviour you have in Mandrake, you should edit your bash config files using the mandrake ones as a model (ie, sourcing ~/.bashrc from ~/.bash_profile, and sourcing /etc/bashrc from ~/.bashrc; also you should source the files in /etc/profile.d either from /etc/bashrc and from /etc/profile in orther to have those settings available independently of the kind of shell session).

 

HTH

Link to comment
Share on other sites

I'm sure the answer is already on this thread but I don't know how to execute it.

 

aru, the line of code you listed does indeed already exist in ~/bash.profile. If I type

source /etc/profile

, I get the prompt that I want, even with color. But I do not understand how to automate this process. I thought I was supposed to add this line to ~/bashrc, but when I did, Igot a terminal with nothing in it, except it would echo whatever I typed!

 

Could you tell me exactly where to put this line?

Link to comment
Share on other sites

Are you by any chance using KDE?

 

If so, read:

 

http://www.mandrakeusers.org/viewtopic.php?t=1898 (Shell prompt problem Reposted from Old board)

http://www.mandrakeusers.org/viewtopic.php?t=4102 (Konsole not reading .bash_profile)

 

Also check that your login shell is bash and not sh (that is also commented in one of the above threads)

 

HTH

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...