LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Change bash prompt for user only (https://www.linuxquestions.org/questions/linux-from-scratch-13/change-bash-prompt-for-user-only-866672/)

spiky0011 03-05-2011 06:22 PM

Change bash prompt for user only
 
On my lfs system I have a prompt root [ ~ ] in red. The user has a prompt of -bash-4.1$. Is it possible to change the user prompt only to something else I,E hostname $. I know that this can be done temporary by
Code:

PS1="\h $"
I would like to leave root as it is, just change the user prompt, Which file do I need to edit? if it,s bashrc would that change it for root as well.
I have googled but cant find exact answer i,m looking for.
I would just like to say that this project has opened my eyes.

Druuna I take my hat of to you for the amount of effort & time you put in to helping ppl i Thank you

AlucardZero 03-05-2011 06:44 PM

Edit the user's .bashrc (in the user's home directory). root will not be effected.

Telengard 03-05-2011 07:00 PM

Assume root, and then:
Code:

echo "export PS1='\h:\w$ '" >> /home/USERNAME/.profile
Replace /home/USERNAME/ with the full path to the user's home directory.

Note that ~/.profile is only read by Bash if ~/.bash_profile and ~/.bash_login do not exist, and only one of the three is automatically executed during Bash startup. The order of precedence is as follows.
  • ~/.bash_profile
  • ~/.bash_login
  • ~/.profile

Bash Reference Manual, 6.2 Bash Startup Files

Edit:
This may only take effect at the user's next login.

druuna 03-06-2011 02:56 AM

Hi,

@spiky0011: You "only" installed LFS, the goodies (including LFS configuration) are done in BLFS.

Have a look: BLFS, especially this chapter: 3 - After LFS Configuration Issues.

Hope this helps.

spiky0011 03-06-2011 03:58 AM

Yes I have started on blfs thks druuna Dose that mean I cant ask qestions in this forum, if not then i,m sorry for posting here.

druuna 03-06-2011 04:00 AM

Hi,
Quote:

Originally Posted by spiky0011 (Post 4280339)
Yes I have started on blfs thks druuna

You're welcome :)

Quote:

Dose that mean I cant ask qestions in this forum, if not then i,m sorry for posting here.
Yep, all LFS (BLFS, CLFS, LFS etc) related questions can be asked right here.


All times are GMT -5. The time now is 11:30 PM.