O'Reilly logo

bash Cookbook, 2nd Edition by JP Vossen, Carl Albing

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Examples Included with bash

The bash tarball includes a lot of material that is well worth exploring (after you’ve finished reading this book, of course). It includes sample code and examples, scripts, functions, and startup files. The easiest way to access this material is via our up-to-date list with hyperlinks, but we’re including this appendix to provide a taste of what you’ll find since few people actually access the tarball or build from source anymore.

bash Documentation and Examples

The startup-files directory provides many examples of what you can put in your own startup files. In particular, bash_aliases has many useful aliases. Bear in mind that if you copy these files wholesale, you’ll have to edit them for your system because many of the paths will be different. Refer to Chapter 16 for further information on changing these files to suit your needs.

The functions directory contains many function definitions that you might find useful. Among them are:

basename

The basename utility, missing from some systems.

dirfuncs

Directory manipulation facilities.

dirname

The dirname utility, missing from some systems.

whatis

An implementation of the Tenth Edition Bourne shell whatis builtin.

whence

An almost exact clone of the Korn shell whence builtin.

If you come from a Korn shell background, you may find kshenv especially helpful. This contains function definitions for some common Korn facilities such as whence, print, and the two-parameter cd builtins. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required