Next Previous Contents

1. Introduction and Administrivia

1.1 Requirements

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.

1.2 How To Use This Document

I include a lot of examples and explanatory text. Different parts will be of varying usefulness to different people. This has grown long enough that reading it straight through would be difficult - just read the sections you need, backtrack as necessary.

1.3 Translations

As I write (6 January 99), translations are under weigh to both Japanese (Akira Endo, akendo@t3.rim.or.jp) and German (Thomas Keil, thomas@h-preissler.de). Many thanks to both of them! URLs will be included when they become available.

1.4 Problems

This is a list of problems I've noticed while programming prompts. Don't start reading here, and don't let this list discourage you - these are mostly quite minor details. Just check back if you run into anything odd.

1.5 Send Me Comments and Suggestions

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. I've tried to check suggestions I make against different versions of Bash (mostly 2.02, which I use, and 1.14.7, which is in wide use), but let me know of any incompatibilities you find.

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.

I use the Linux Documentation Project HOWTOs almost exclusively in the HTML format, so when I convert this from SGML, HTML is the only format I check thoroughly. If there are problems with other formats, I may not know about them, and I'd appreciate a note about them.

1.6 Credits

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).

1.7 Copyright and Disclaimer

This document is copyright 1998-1999 by Giles Orr. You are encouraged to redistribute it. You may not modify this document (see the section on contacting me: I have so far been incorporating all changes recommended by readers). Please contact me if you're interested in doing a translation: that's one modification I can live with.

This document is available for free, and, while I have done the best I can to make it accurate and up to date, I take no responsibility for any problems you may encounter resulting from the use of this document.


Next Previous Contents