Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've altered the /etc/bashrc file.

I commented out the previous definition and inserted my own:

PS1="--bash: (\u@\h:\w) $"

This is not having any affect. When I make this change at the command prompt, it works great, but then it's not permanent.

share|improve this question

1 Answer 1

/etc/bashrc is the system setting. The usual place to change the prompt would be the per-user file, ~/.bashrc. You might already have a setting there that's overwriting the system default. Put your prompt string in ~/.bashrc.

Furthermore, there is a quirk in bash's handling of initialization files. The /etc/bashrc and ~/.bashrc files are only read for interactive instances of bash that are not login shell. If you run a login shell, bash only reads /etc/profile, and ~/.bash_profile (or ~/.profile if it doesn't exist). You need to explicitly source your .bashrc from your .bash_profile if the login shell is interactive:

# Work around a well-known bash design bug: bash does not read .bashrc if
# it is invoked as a login shell.
case "$-" in *i*) if test -r ~/.bashrc; then . ~/.bashrc; fi;; esac
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.