title: Displaying active conda virtual environment in terminal via .bash_profile
body: <p><strong>Problem</strong></p>
  
  <p>I am trying to customize my Terminal to show key information more clearly, and colour code it. </p>
  
  <p>I am currently having an issue when activating a new conda virtual environment, where it duplicated the name twice.</p>
  
  <p>I have tried implementing $CONDA_DEFAULT_ENV, $CONDA_PREFIX in the .bashrc file to no avail and have also played around editing the .bash_profile anaconda code through trial and error.</p>
  
  <p><strong>.bash_profile</strong></p>
  
  <pre><code># added by Anaconda3 2019.07 installer
  # &gt;&gt;&gt; conda init &gt;&gt;&gt;
  # !! Contents within this block are managed by 'conda init' !!
  __conda_setup="$(CONDA_REPORT_ERRORS=false '/anaconda3/bin/conda' shell.bash hook 2&gt; /dev/null)"
  if [ $? -eq 0 ]; then
      \eval "$__conda_setup"
  else
      if [ -f "/anaconda3/etc/profile.d/conda.sh" ]; then
  # . "/anaconda3/etc/profile.d/conda.sh"  # commented out by conda initialize
          CONDA_CHANGEPS1=false conda activate base
      else
          \export PATH="/anaconda3/bin:$PATH"
      fi
  fi
  unset __conda_setup
  # &lt;&lt;&lt; conda init &lt;&lt;&lt;
  
  # !! Connects to .bashrc file for customization !!
  if [ -f ~/.bashrc ]; then
      source ~/.bashrc
  fi
  </code></pre>
  
  <p><strong>.bashrc</strong></p>
  
  <pre><code>green=$(tput setaf 71);
  white=$(tput setaf 250);
  reset=$(tput sgr0);
  
  PS1="\[${green}\](\$(basename \$CONDA_DEFAULT_ENV)) ";  # virtual env
  PS1+="\[${white}\] $(pwd)/\W";                          # current directory
  PS1+="\[${white}\] \n ";                                # new line
  PS1+="\[${reset}\]-&gt; ";                                 # code prompt
  export PS1;
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <p>As you can see below (flask_env) once activated repeats itself and only the second entry is formatted green:</p>
  
  <pre><code>(base)  /Users/AlexBargh/~
   -&gt; conda activate flask_env
  (flask_env) (flask_env)  /Users/AlexBargh/~
   -&gt;
  </code></pre>
  
  <p><strong>Desired Output</strong></p>
  
  <p>If i run <code>source .bashrc</code> again in the terminal this issue seems to resolves itself - just want to code it in.</p>
  
  <p>I am trying to get rid of the first (flask_env) entry just to keep (base) and (flask_env) both formatted green. </p>
  
  <p>Any help much appreciated!</p>