Skip to Main Content
Learning the Korn Shell, 2nd Edition
book

Learning the Korn Shell, 2nd Edition

by Arnold Robbins, Bill Rosenblatt
April 2002
Beginner content levelBeginner
432 pages
18h 29m
English
O'Reilly Media, Inc.
Content preview from Learning the Korn Shell, 2nd Edition

Chapter 9. Debugging Shell Programs

We hope that we have convinced you that the Korn shell can be used as a serious Unix programming environment. It certainly has plenty of features, control structures, etc. But another essential part of a programming environment is a set of powerful, integrated support tools. For example, there is a wide assortment of screen editors, compilers, debuggers, profilers, cross-referencers, etc., for languages like C, C++ and Java. If you program in one of these languages, you probably take such tools for granted, and you would undoubtedly cringe at the thought of having to develop code with, say, the ed editor and the adb machine-language debugger.

But what about programming support tools for the Korn shell? Of course, you can use any editor you like, including vi and Emacs. And because the shell is an interpreted language, you don’t need a compiler.[113] But there are no other tools available. The most serious problem is the lack of a debugger.

This chapter addresses that lack. The shell does have a few features that help in debugging shell scripts; we’ll see these in the first part of the chapter. The Korn shell also has a couple of new features, not present in most Bourne shells, that make it possible to implement a full-blown debugging tool. We show these features; more importantly, we present kshdb, a Korn shell debugger that uses them. kshdb is basic yet quite usable, and its implementation serves as an extended example of various ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning the Korn Shell

Learning the Korn Shell

Bill Rosenblatt
Unix Power Tools, 3rd Edition

Unix Power Tools, 3rd Edition

Jerry Peek, Shelley Powers, Tim O'Reilly, Mike Loukides

Publisher Resources

ISBN: 0596001959Supplemental ContentErrata Page