You will need Bash. The default version on almost
all Linux distributions is 1.14.7 (as of this writing, November 98), which
is a well known and reliable shell.
Bash is now available in version 2.0+: I've been using Bash 2.0 for a
while now, but almost all code presented here should work under 1.14.7.
If I'm aware of a problem, I'll mention it. You can check your Bash
version by typing echo $BASH_VERSION
at the prompt. On my
machine, it responds with 2.02.1(1)-release
.
Shell programming experience would be good, but isn't essential: the more you know, the more complex prompts you'll be able to create. I assume a basic knowledge of shell programming and Unix utilities as I go through this tutorial. However, my own shell programming skills are limited, so I give a lot of examples and explanation that may appear unnecessary to an experienced shell programmer.
This is a learning experience for me. I've come to know a fair bit about what can be done to create interesting and useful Bash Prompts, but I need your input to correct and improve this document. The latest version of this document should always be available at http://www.interlog.com/~giles/bashprompt.html. Please check this out, and feel free to e-mail me at giles@interlog.com with suggestions.
In producing this document, I have borrowed heavily from the work of the Bashprompt project at http://bash.current.nu/. Other sources used include the xterm Title mini-HOWTO by Ric Lister, available at http://sunsite.unc.edu/LDP/HOWTO/mini/Xterm-Title.html, Ansi Prompts by Keebler, available at http://www.ncal.verio.com/~keebler/ansi.html, How to make a Bash Prompt Theme by Stephen Webb, available at http://bash.current.nu/bash/HOWTO.html, and X ANSI Fonts by Stumpy, available at http://home.earthlink.net/~us5zahns/enl/ansifont.html.
Also of immense help were several conversations and e-mails from Dan, a co-worker at Georgia College & State University, whose knowledge of Unix far exceeds mine. He's given me several excellent suggestions, and ideas of his have led to some interesting prompts.
Three books that have been very useful while programming prompts are Linux in a Nutshell by Jessica Heckman Perry (O'Reilly, 1997), Learning the Bash Shell by Cameron Newham and Bill Rosenblatt (O'Reilly, 2nd. ed., 1998) and Unix Shell Programming by Lowell Jay Arthur (Wiley, 1986. This is the first edition, the fourth came out in 1997).