title: bash: How to evaluate PS1, PS2, ...?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3451993/echo-expanded-ps1">Echo expanded PS1</a>  </p>
  </blockquote>
  
  
  
  <p>Is there any way to 'evaluate' <code>PS1</code>, <code>PS2</code>, etc from within a bash script?</p>
  
  <p>Although, I can use alternate means to get all elements of my current <code>PS1</code>, I would really like to be able to reuse its definition instead of using these alternate means. </p>
  
  <p>For example, </p>
  
  <pre><code>=====================================
   PS1 element --&gt;     Alternate means
  =====================================
   \u          --&gt;     $USER
   \h          --&gt;     $HOSTNAME
   \w          --&gt;     $PWD
   ...
  =====================================
  </code></pre>
  
  <p>I could very well use the 'alternate means' column in my script, but I don't want to. In my <code>PS1</code>, I, for example, use bold blue color via terminal escape sequences which I'd like to be able to simply reuse by evaluating <code>PS1</code>.</p>