Startup-Files Directory 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:
basenameThe basename utility, missing from some systems
dirfuncsDirectory manipulation facilities
dirnameThe dirname utility, missing from some systems
whatisAn implementation of the Tenth Edition Bourne shell whatis built-in
whenceAn almost exact clone of the Korn shell whence built-in
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 built-ins.
The scripts directory contains many examples of bash scripts. The two largest scripts are examples of the complex things you can do with shell scripts. The first is a (rather amusing) adventure game interpreter and the second is a C shell interpreter. The other scripts include examples of precedence rules, a scrolling text display, a “spinning wheel” progress display, and how to prompt the user for a particular type of answer.
Not only are the script and function examples useful for including in your ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access