How to insert an environment variable inside the bash prompt
you need to add backslash to get it evaluated not in the time of FOO assigment but during evaluating the PS1, so do: export PS1=”[\$FOO]$ ” instead of: export PS1=”[$FOO]$ ” Note the \ before the $FOO.