2007/12/01

MOSX: My $PS1

PS1='\[\e]0;\u@\h\a\]\D{%Y%m%d-%H%M%S} \u@\h \W [\j]\n$ '

This sets the Terminal title bar to:
user@node - current-command

Which is dynamic; it changes as you issue commands. (Slick.)

And it sets the prompt to:
date-time user@node working-dir [jobs]
$

It's an awfully long prompt, so it wraps, and puts the familiar "$" at the start of the *second* line.

Why? It's sometimes *very* handy to have the prompt indicate when that command was issued.

(BTW: Bracketing the window title bar potion in "\[" and "\]" is critical; otherwise (since it doesn't print those char in the prompt itself) readline will miscalculate where you are on the line and things get ugly.)

No comments: