Common Uses of Shell Scripts

Common Uses of Shell Scripts

Although there are virtually unlimited uses for shell scripts (for example, we know of at least one that generates Web pages that are thumbnail indexes of images: www.acme.com/software/thumbnail_index), there are some uses that are more common than others. Here are the most common uses of shell scripts.

System-startup configuration files

Mac OS X/Darwin keeps its system-startup files in /System/Library/StartupItem (virtually every other version of Unix keeps similar scripts in /etc/rc.d or /etc/init.d ).

Automating common tasks

One example is the Bourne shell script /etc/weekly , which is run once each week by a scheduling program called launchd . (See Chapter 11, "Introduction to System Administration," to learn about the launchd command.) The /etc/weekly script rebuilds a couple of databases and compresses a few system log files. You can open it using vi or nano if you likeyou won't hurt anything by reading the file.

Creating new utilities for your personal use

In Chapter 2 you created a simple script to show a system status report. As you become more comfortable with Unix, you will undoubtedly create several small scripts to automate tasks, provide new commands, and in general handle problems that the existing set of commands doesn't quite cover. One example might be a shell script that allows you to use the Macintosh Trash from the command line.



Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net