| first line: || Describe the script. Comments should also include what command line arguments the script requires, author, date of creation, etc. |
| second line: || Test the value of the $# variable to determine how many items were on the command line when the script was started. This script does not test the validity of the values, only that the correct number of items are included. |
| lines 3-7 – echo and exit: || If the test for “not equal to 2” succeeded, the user running the script has not provided the needed information. Use the |
echo command to print a usage message and then stop the script with the
| line 8: || End the block of commands that are executed when the |
if/then test returns true. In this case, the $# variable indicates that the incorrect number of command line arguments were included.
| line 9: || Run the database utility called convertdb, using the command line parameters entered by the user running the script as values for the utility. The values are accessed as $1 and $2 and placed in the command line where convertdb requires them. Write out the resulting file to a new temporary file called tmp with the process ID of the script as a file extension. Using the PID as a file extension simply creates a unique filename for temporary use. (For example, the temporary file might be called |
| line 10: || Run the filterdb utility on the temporary file created in the previous step using the convertdb program. Write the results back to the original filename provided by the user. That filename is stored in the variable $1. |