home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 8.1 What the Shell Does Chapter 8
How the Shell Interprets What You Type
Next: 8.3 Introduction to tcsh
 

8.2 Introduction to bash

Until the early 1990s, most UNIX users worked interactively with the C shell or the Bourne shell. The Korn Shell, an extended Bourne shell, had been around since the mid '80s and was getting more popular. Since then, two freely available shells with even more features- tcsh ( 8.3 ) and bash -have been getting a lot of attention. This article introduces bash .

The "Bourne-again shell" (named with the usual punny FSF humor) comes from the Free Software Foundation. Although the name is a joke, the shell isn't! I've used UNIX shells for 15 years, and I was really impressed when I started to read about bash (in O'Reilly & Associates' Learning the bash Shell ). Since then I've used bash as my login shell. The shell has a lot of features that ksh and csh (and especially sh !) don't, but I wouldn't call it "feeping creaturism." [1] Here are some of my favorite features:

[1] A term with a :-) you'll hear for "creeping featurism," which means bloating software with lots of little-used features.

  1. More than 60 shell variables ( 6.8 ) . These let me get information I need for shell setup files ( 2.2 ) and also let me configure the shell to do what I want.

  2. I like to pack information into my shell prompt ( 7.5 ) . (I haven't added the temperature in Rio de Janeiro yet, but I'm working on it. :-) ) bash lets me run external UNIX commands, as well as shell commands, and update each prompt on-the-fly. It can also run UNIX or shell commands (and display the output if any) before each prompt is printed. For instance, bash can run a quick system check and put notes in my prompt (or the top of the window) to warn me about problems, count the current users, tell me who's just logged in (and out), etc., etc.

  3. bash has both vi and Emacs command-line editing ( 11.13 ) . But it also has the original C shell history substitution ( 11.7 ) . There are plenty of times when a short expression like ^k (or even !lpr:gs/2/3 ) is faster than cursoring up and over to edit a previous command line. bash lets me choose.

  4. I stick to the Bourne Shell for any programs I distribute to other users: not enough people have bash yet. But it does have some very nice features for scripts and shell functions of my own - like powerful string-manipulation operators, file tests, and built-in integer arithmetic.

bash
bash is constantly being updated. The edition on the CD-ROM will probably be a little out of date by the time you get it. If you want a few more features, a few bug fixes (and, maybe, a few new bugs too), check a GNU archive on the Net for the latest version.

- JP


Previous: 8.1 What the Shell Does UNIX Power Tools Next: 8.3 Introduction to tcsh
8.1 What the Shell Does Book Index 8.3 Introduction to tcsh

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System