LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Newbie questions:Bash Prompts (https://www.linuxquestions.org/questions/linux-newbie-8/newbie-questions-bash-prompts-155724/)

newinlinux 03-10-2004 02:41 AM

Newbie questions:Bash Prompts
 
Hi All,
I have my bash prompts set to PS1="[\t][\u@\h:\w]\$ in my /home/user directory with a .bashrc, it works for the user. But I just don't know how to do it for the root. I made one .bashrc file at /root and at /home, both wont work. Any clue? Thanks!

iluvatar 03-10-2004 02:57 AM

don't know... I put this in my /root/.bashrc to test:

#!/bin/bash
PS1="[\t][\u@\h:\w]\$
export PS1

works fine, nice bash prompt btw :)

newinlinux 03-10-2004 03:01 AM

hmm, i didn't put the export PS1 under PS1="[\t][\u@\h:\w]\$. I will try it tonight. My user is showing the prompt nicely, only the root is not, strange. Thanks for your reply.

iluvatar 03-10-2004 03:02 AM

seems you don't actually have to export it :p it works for me anyway...

newinlinux 03-10-2004 03:04 AM

Quote:

Originally posted by iluvatar
seems you don't actually have to export it :p it works for me anyway...
you mean both user and root work?:confused:

iluvatar 03-10-2004 03:35 AM

yes, both work fine with me... maybe there's something going on in your /etc/zprofile file, that's a system-wide profile configuration, contains some bash prompt stuff also (they are exported there too)
can't u change that one?

hw-tph 03-10-2004 03:59 AM

What happens when you source your ~/.bashrc? Tye source ~/.bashrc and see if your prompt changes to the one you specified. If so your problem is that it's just not executed when you log in.

Make sure your .bashrc is sourced (executed) from your ~/.bash_profile. In the latter you should have lines approximately like these:
Code:

if [ -e ~/.bashrc ]
then
    source ~/.bashrc
fi

This will make the commands in your .bashrc always are executed.


Håkan

newinlinux 03-10-2004 07:47 AM

hakan, thanks, the source works, but my .bash_profile doesn't help. I created a .bash_profile at my home directory but the prompt is still showing bash-2.05b# rather than my preferred:

8.15PM root@darkstar:/#

Any other ideas:confused: ?

JZL240I-U 03-10-2004 08:54 AM

No ideas but stuff to study:

http://theory.uwinnipeg.ca/UNIXhelp/...hell_help.html

http://www.justlinux.com/nhf/Shells/..._Commands.html

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html

http://www.dreaming.org/~giles/bashprompt/

http://www.onlamp.com/linux/cmd/

Have fun :D.

newinlinux 03-10-2004 06:15 PM

thanks. I will experiment more.


All times are GMT -5. The time now is 01:18 AM.