DOC HOME
SITE MAP
MAN PAGES
GNU INFO
SEARCH
PRINT BOOK
Automating frequent tasks
Creating a shell script
Running a script under any shell
Writing a short shell script: an example
Passing arguments to a shell script
Performing arithmetic and comparing variables
Performing arithmetic on variables in the Korn shell
Sending a message to a terminal
The echo command
The print command (Korn shell only)
More about redirecting input and output
Getting input from a file or a terminal
Reading a single character from a file or a terminal
Attaching a file to a file descriptor
What to do if something goes wrong
Solving problems with the environment
Solving problems with your script
What to do if your shell script fails
Writing a readability analysis program: an example
How to structure a program
Making a command repeat: the for loop
Getting options from the command line: getopts
Repeating commands zero or more times: the while loop
Repeating commands one or more times: the until loop
Making choices and testing input
Choosing one of two options: the if statement
Different kinds of test
Testing exit values
The && and || operators
Making multiway choices: the case statement
Generating a simple menu: the select statement
Expanding the example: counting words
Making menus
Assigning variables default values
Tuning script performance
How programs perform
How to control program performance
Number of processes generated
Number of data bytes accessed
Shortening data files
Shortening directory searches
Directory-search order and the PATH variable
Recommended ways to set up directories
Putting everything together
Readability analysis
Extending the example
Other useful examples
Mail tools
Count the number of messages in MMDF mail folder
Print the header lines of every message in a folder
Mail a large file, in pieces
File tools
Return the total size of a group of files
Compress a batch of files concurrently
Useful routines
Locking files
Context sensitive scripts