title: bash prompt shell displayed differently in terminal and tty console
body: <p>This is a portion of my ~/.bashrc:</p>
  
  <pre><code>prompt(){
      local EXIT="$?"  # return code
      PS1=""
      local red="\[\033[0;31m\]"  # text colour
      local purple="\[\033[0;35m\]"  # text colour
      local normal="\[\033[0m\]"  # text colour
  
      if [ $EXIT == 0 ]; then  # $EXIT colour based upon its value
          local return="${normal}${?}"
      else
          local return="${red}${?}${normal}"
      fi
  
      PS1+="${normal}[${purple}\\D{%-l:%M%P}${normal}]${return} \\[\\e]0; \
      \\u@\\h: \\w\\a\\]${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$ "
  }
  
  export PROMPT_COMMAND=prompt
  </code></pre>
  
  <p>This is my prompt shell in gnome-terminal (correctly displayed):</p>
  
  <pre><code>[5:01pm]0 user@host:~$
  </code></pre>
  
  <p>But when I switch to tty console, after I logged in, this is displayed:</p>
  
  <pre><code>[5:05pm]0 ;user@host: ~user@host:~$
  </code></pre>
  
  <p>This happens with regular user, but also with root on the same notebook on the same operating system.
  Colours are always correctly displayed, the only problem is with the way the prompt is displayed.</p>
  
  <hr>
  
  <p>Sofware versions:</p>
  
  <ul>
  <li>GNU bash, version 4.3.11(1)-release (i686-pc-linux-gnu),</li>
  <li>Ubuntu Gnome 14.04.</li>
  </ul>
  
  <hr>
  
  <p>Some explanation of the PS1 value:</p>
  
  <pre><code>[5:01pm]   # current time
  0          # return/exit code of the last command (0 can be any number;
             # if return code has a non-zero value, it turns red)
  </code></pre>
  
  <hr>
  
  <p>PS – Currently in tty consoles, I need to <code>source ~/.bashrc</code> to be able to used all of my settings. (1) Where is located the tty console’s own .bashrc? (2) Or how to set it up to use the <code>~/.bashrc</code>?</p>
  
  <hr>
  
  <p><strong>Solution of the different behaviour of prompt</strong></p>
  
  <p>As the accepted answer suggests, in PS1 variable, there was a part which should be omitted, thus I just changed the last row of the function to</p>
  
  <pre><code>PS1+="${normal}[${purple}\\D{%-l:%M%P}${normal}]${return} \
  ${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$ "
  </code></pre>
  
  <hr>
  
  <p><strong>Solution of the Post Scriptum (PS)</strong></p>
  
  <p>tty consoles use <code>~/.bashrc_profile</code> instead of <code>~/.bashrc</code>, because (as @chepner said in comment below) the latter is sourced by GUI terminal emulator (for it usually starts a non-login interactive shell). tty console is an interactive shell.</p>
  
  <p>My solution is to add the following to <code>~/.bash_profile</code>:</p>
  
  <pre><code>. ~/.bashrc
  </code></pre>