Bash provides an environment variable called PROMPT_COMMAND. The contents of this variable are executed as a regular Bash command just before Bash displays a prompt.
Insira uma instrução if / then em PROMPT_COMMAND para alterar sua variável PS1. Adicione esta linha ao seu .bashrc:
PROMPT_COMMAND='if [ $PWD == $HOME ]; then PS1="[\d \t \u@\h:myDirectory! ] $ "; else PS1="[\d \t \u@\h:\w ] $ "; fi'