O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 23. Debugging scripts

One of the most annoying tasks of shell scripting is debugging problems. There are aids to help you but, to prevent most errors before they happen, follow this rule:

Break your proposed script down into tasks or procedures, then code and test each procedure before continuing with the next step.

In this chapter we will cover:

  • common errors; and

  • introducing the set command.

There really is nothing more irritating than trying to discover an elusive error in your script. However, as you get more experienced in scripting you’ll know what to look for.

The most common problems are missing quotes or not having an fi on the end of an if statement.

One important thing to remember is that when the shell reports an error from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required