Fork me on GitHub
#off-topic
<
2016-05-05
>
bojan.matic15:05:37

does anyone know why bash would suddenly start ignoring the $PS1 I export?

bojan.matic15:05:03

i have a .bashrc file that I move around with me to different machines, this time it just refuses to change the prompt

bojan.matic15:05:41

vindicator:~ bojan$ export PS1="\n\[$Blue\]\u\[$Color_Off\] at \[$Yellow\]\h\[$Color_Off\] in \[$Green\]\w\n\[$Color_Off\]> "
vindicator:~ bojan$ echo $PS1
\h:\W \u\$
vindicator:~ bojan$

mikepjb15:05:17

is that bash or zsh? that doesn't look like bash PS1 syntax to me

bojan.matic15:05:36

it worked always

bojan.matic15:05:52

it doesn’t matter what i type

bojan.matic15:05:02

whatever i export PS1 to, it remains unchanged

bojan.matic15:05:19

i never saw this and have no idea why it would be broken this way

bojan.matic15:05:10

i have defined $Blue, $Color_Off etc. somewhere before that line

bojan.matic15:05:09

here, without the colors

bojan.matic15:05:13

vindicator:~ bojan$ export PS1="\n\u at \h in \w\n> "
vindicator:~ bojan$ echo $PS1
\h:\W \u\$

bojan.matic16:05:55

when I execute a subshell it works

bojan.matic16:05:02

vindicator:~ bojan$ PS1="\n\u at \h in \w\n> " bash

bojan at vindicator in ~
>

curtis.summers16:05:39

@bojan.matic: are you by chance using tmux?

bojan.matic16:05:02

no, this is in a pure iterm or Terminal session

bojan.matic16:05:09

i am flabbergasted

bojan.matic16:05:20

it’s as if PS1 is silently read-only

curtis.summers16:05:00

strange...you might echo $PROMPT_COMMAND and the find the function that it gives you and follow it for clues.

bojan.matic16:05:37

vindicator:~ bojan$ echo $PROMPT_COMMAND
bash_prompt
vindicator:~ bojan$ which bash_prompt
vindicator:~ bojan$ type bash_prompt
bash_prompt is a function
bash_prompt ()
{
    PS1="$(build_prompt)"
}
vindicator:~ bojan$

bojan.matic16:05:07

i found it, i was sourcing oh-my-git before setting PS1

bojan.matic16:05:34

i moved some configs around so it ended up being sourced earlier