how to change the shell prompt globally
I want to change the bash shell prompt. So far, every post I've seen on this discusses changing the user's .bashrc or .bash_profile. That's not what I want. I want to change the prompt globally for all users.
I've modified the PS1 env. variable in /etc/profile, but that does nothing. Where do I do this? |
Changing /etc/profile isn't going to affect shells that are already running. Only newly spawned login shells will be automaticlly reading that file. Nor will setting PS1 in /etc/profile affect any users that set their own PS1 in their .bash_profile or .bashrc files.
|
I figured it out. PS1 is set all over the place (sometimes I think Ubuntu is going "Microsoft" on us!). In order to get a common, unified PS1 for this system, I did the following:
1. set the promt I want in /etc/profile: Code:
1 if [ "$PS1" ]; then /etc/bash.bashrc is sourced by /etc/profile (line 6), and it too wants to set PS1. I commented out the PS1 setting in this file, which is the 19th line in my version: Code:
# set a fancy prompt (non-color, overwrite the one in /etc/profile) Code:
59 #if [ "$color_prompt" = yes ]; then |
Wait! There's more! gnome-terminal does not source /etc/.profile (see here: http://askubuntu.com/questions/40287...-being-sourced). To get it to do so, (in the menu bar) Edit > Profile Preferences > Command > Check: "Run command as a login shell"
Who knew that setting the shell prompt could evolve into such complexity! |
You could just put the setting in /etc/bashrc, which would get sourced by non-login shells too.
|
All times are GMT -5. The time now is 06:03 AM. |