You are not logged in.
This is my PS1 in /etc/profile
export PS1="[u@h]-[${PWD}]-#-$> "
That means my prompt will look like this:
[username@Hostname]-[/current/directory]-1-$>
This is okay initially, however, if I "cd /some/directory", the bash prompt doesn't say /some/directory, but it remains /current/directory (I know, not really the current directory but the initial directory)
How is this possible? I may have upgraded bash lately, so maybe bash is broken? Maybe it has something to do with initscripts? If I "echo ${PWD}", it echoes the correct new directory, but the prompt doesn't get updated.
Offline
why don't you use
export PS1="[u@h]-[w]-#-$> "
?
ok, it shows ~ instead of /home/foo, else it's what you want..
Offline
You're right, that works, although it doesn't solve the problem with ${PWD}... and to be honest, I prefer /home/myusername instead of ~. :oops:
Offline
The problem is that "${PWD}" is being interpreted by the shell at the time you set the prompt. If you quote it like this "${PWD}" then the shell will interpret it at every prompt & you'll get the behavior you want.
Offline
Thanks, that works.
It is weird though, because it used to work all the time... (I'm using Arch for over a year now). Maybe something has changed, but it doesn't matter anymore, it works and I'm happy with the result.
Offline