Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://mywiki.wooledge.org/BashFAQ/053" rel="noreferrer"><a href="http://mywiki.wooledge.org/BashFAQ/053" rel="noreferrer">http://mywiki.wooledge.org/BashFAQ/053</a></a> -- I have a fancy prompt with colors, and now bash doesn't seem to know how wide my terminal is. Lines wrap around incorrectly.</p> <p>By the way; for your reference; here's my <code>PS1</code> which looks like this: <a href="http://lhunath.lyndir.com/stuff/PS1.png" rel="noreferrer" title="PS1">alt text http://lhunath.lyndir.com/stuff/PS1.png</a></p> <pre><code>\[$reset$bold$green\]\u@\h\[$blue\] \W \[$red\]${?/#0/\[$green\]}\$\[$reset\] </code></pre> <p>Notice how I put all the color codes in <code>$parameters</code> to make it neater, but more importantly, because <strong>you should be using <code>tput</code> to generate them</strong>. See:</p> <p><a href="http://mywiki.wooledge.org/BashFAQ/037" rel="noreferrer"><a href="http://mywiki.wooledge.org/BashFAQ/037" rel="noreferrer">http://mywiki.wooledge.org/BashFAQ/037</a></a> -- How can I print text in various colors?</p> <p>I declare my color parameters in a utility script that gets sourced by <a href="http://lhunath.lyndir.com/stuff/.bashrc" rel="noreferrer">my <code>~/.bashrc</code></a> (and any scripts I write) which is called <a href="http://lhunath.lyndir.com/stuff/bashlib" rel="noreferrer"><code>bashlib</code></a>.</p> <p>On a final note; put your <code>PS1</code> definition in <code>~/.bashrc</code> and don't <code>export</code> it. There's absolutely no reason why you should add your <code>PS1</code> definition to the environment of any and all processes you spawn from your shell.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload