The shell prompt in bash can be modified to provide useful information. There are environmental variables that can be set to control the prompt string (see the bash manpage for more information). One of the more useful things, in my opinion, to include in the prompt string is the current path (so you always knows where you are without having to run pwd). The paths for deeply nested subdirectories can get quite long, however, leaving precious little space for commands. (Bash will wrap these, of course, but, still, annoying.) Dr. Drang details a solution in zsh that allows right-justified strings that can be overwritten. zsh is cool and all, but if you are not prepared to abandon bash (the default shell on OS X), you might try a multiline prompt. I have the following in my .profile:
PS1="\n\
\$PWD\n\
$BOLD\h-\u$DIM $ "; export PS1
PS2="more=> "; export PS2
Which produces the following shell prompt:

How apt a solution this is will depend, of course, on how precious vertical space in the terminal is to you. (Dr. Drang mentioned something about his left eye twitching uncontrollably.) So your mileage may vary.
{ 1 } Trackback
[…] so you know a meeting is boring when you would rather redo your bash prompt. (And, yes, as a consequence, I have come to appreciate the point of running a […]
Post a Comment