Re: Strange bash prompt
XRDLAB wrote:
>
> Hi,
>
> I noticed a strange behaviour of bash regrding the prompt. I have set
> PS1='\h:\w$ '. With that I get both the host name and the working
> directory as my shell prompt. Yesterday I noticed a strange behaviour
> accidentally. The sequence is given below:
>
> mysxrd:~$ cd /var
> mysxrd:/var$ ---- prompt is correct
> mysxrd:/var$ cd ../usr
> mysxrd://usr$ ---- prompt has 2 slashes!
>
> I am surprised by this behaviour. Is it expected? The bash version is:
> GNU bash, version 2.01.1(1)-release (i486-pc-linux-gnu)
>
I don't have an answer, but I vaguely remember once upon a time
trying the "/w" switch in my prompt and getting odd results, so I
went back to using "$PWD" which seems to work fine for me in most
cases. Nonetheless, I just tried the sequence you outlined, and I
get the same results using "$PWD". Hmmm, inter-r-resting.
Reply to: