In this module, you learned some techniques to debug shell scripts. You also looked at some commonly found errors.
This module introduced you to the following commands:
In this module, you learned how to:
Use shell options to test each line of a script
Identify syntax errors and logic errors
Insert shell commands to list the progress of a script
Run a shell script with tracing options
Use the trap command to handle signals sent to a shell script
This module introduced you to the following terms:
trace/tracing: Shell tracing simply means tracing the execution of the commands in a shell script.
To switch on shell tracing, use the
-x debugging option.
trap: Trap allows you to catch signals and execute code when they occur. Signals are asynchronous notifications that are sent to your script when certain events occur.
signal: You can list down all the signals supported by your system.
Just issue the kill -l command to display all the supported signals.
syntax error: A syntax error is an error in the source code of a program. Since computer programs must follow strict syntax to compile correctly, any aspects of the code that do not conform to the syntax of the programming language will produce a syntax error.
logic error: A logic error (or logical error) is a mistake in a program's source code that results in incorrect or unexpected behavior.
The next module is about collecting script commands into logical groupings called functions.