I'm a linux and Bash newbie and would like to ask help understanding the role of single and double quotes when assigning the PS1 env var. I wanted to set the terminal to always show the current directory. At first I tried this:
export PS1="\[\e[38;5;46m\]>\[\e[38;5;255m\]\[\e]0;$(pwd)\007\]"
This caused the terminal title updated to show the current directory when I hit Enter but not if I subsequently cd'ed to somewhere else.
Through aimless trial-and-error, I eventually tried:
export PS1='\[\e[38;5;46m\]>\[\e[38;5;255m\]\[\e]0;$(pwd)\007\]'
The second version, using the single-quotes, had my desired effect: the terminal title updated every time I cd'ed to a new directory.
Can someone explain why the use of single and double quotes differs this way? Thank you.
I found this discussion: How to change the title of the mintty window? but the OP seems to have not flagged an answer, and those answers that I tried from that link seemed to have no effect in my shell.