$ /ls
The most recently executed ls command appears at the prompt:
$ ls -altr
To remove the r option, use the right arrow key to place the prompt over the r on the screen, and press X to remove the r from the end of the command. After you’ve edited the command, press the Enter or Return key to execute it.
Developing Standard Scripts
I’ve worked in shops where the database administration team developed hundreds of scripts and utilities to help manage an environment. One company had a small squad of DBAs whose job function was to maintain the environmental scripts. I think that’s overkill. I tend to use a small set of focused scripts, where each script is usually less than 50 lines long. If you develop a script that another DBA can’t understand or maintain, then it’s probably too complicated.
■
Note
All the scripts in this chapter are available for download from the Apress web site at www.apress.com. Go to the catalog page for this book. Look for the Source Code link under the book’s cover image.
This section contains several short shell functions, shell scripts, and SQL scripts that can help you manage a database environment. This is by no means a complete list of scripts—rather, it provides a starting point you can build on. Each subsection heading is the name of a script.
■
Note
Before you attempt to run a shell script, ensure that it’s executable. Use the chmod command to achieve this: chmod 750