Use the PROMPT_COMMAND variable to define the function that sets yours PS1after each command. Put this at the bottom of the .profile file instead of the destination PS1:
prompt_cmd () {
PS1="${PYTHON_VIRTUALENV}$PURPLE\$(set_rvm_prompt)$NO_COLOUR\u@\h:[\W]${B_STATE}\$(parse_git_branch)$NO_COLOUR\$ "
}
PROMPT_COMMAND=prompt_cmd
Now, before displaying the prompt, it bashwill execute the function prompt_cmd, updating PS1for the latest information in accordance with PYTHON_VIRTUALENV, set_rvm_prompt()and parse_git_branch().
source
share