Unix Commands  «Prev  Next»
Lesson 1

Debugging Shell Scripts

When you create and run a shell script, you will see error messages from the shell indicating problems it detects with your script. This is most often due to syntax errors you have introduced during the process of writing the script. These messages help you identify the errors and correct them. Your script may also encounter problems processing user data. These errors will reveal themselves when the user enters invalid data or data that you have not anticipated. This module provides tools to locate and correct these errors. It also looks at common errors found in scripts. In this module, you will learn to:
  1. Use shell options to test each line of a script
  2. Identify syntax errors and logic errors
  3. Examine errors that involve the if statement
  4. Run a shell script with tracing options
  5. Examine errors involving input from the user
  6. Correct syntax errors in a given script
  7. Use the set command to trace a portion of a script
  8. Use the trap command to handle signals sent to a shell script