Page 1 of 1
Changing my PS1 variable in SSH?
Posted: Tue Jun 26, 2012 3:55 pm
by zgold
I can't seem to modify the PS1/PLAINPS1 variables that are set in SSH.
Personally, I think this looks awful:
and I want to change it to this:
I attempted to put this into my .bash_profile and .bashrc:
Code: Select all
PS1="[\u@\h \W] $ "
PLAINPS1="[\u@\h \W] $ "
... but it doesn't run upon login.
Any ideas?
Re: Changing my PS1 variable in SSH?
Posted: Tue Jun 26, 2012 4:56 pm
by joemuller
It might be failing because the square brackets aren't escaped with a backslash '\'. Try the following:
Re: Changing my PS1 variable in SSH?
Posted: Tue Jun 26, 2012 5:15 pm
by zgold
joemuller wrote:It might be failing because the square brackets aren't escaped with a backslash '\'. Try the following:
Nope, that didn't work either.
Re: Changing my PS1 variable in SSH?
Posted: Tue Jun 26, 2012 6:04 pm
by joemuller
I was able to get it to work once with this:
I'm not sure why the PS1 variable is being clobbered, but it's happening to me too!
Re: Changing my PS1 variable in SSH?
Posted: Tue Jun 26, 2012 7:03 pm
by zgold
Re: Changing my PS1 variable in SSH?
Posted: Thu Jun 28, 2012 2:30 pm
by joemuller
With a bit of help, I figured out a way to make it work:
The first thing you'll need to do is remove your .bash_profile:
Then, we create a symlink to your bashrc file:
Finally, change your line with PS1 to be the following:
The important part is that the 'export' portion exists. The changes should take effect the next time you log in.
Re: Changing my PS1 variable in SSH?
Posted: Thu Jun 28, 2012 2:48 pm
by zgold
Works! Thank you!