Debugging Korn Shell Scripts

The Korn shell provides a number of options that are useful in debugging scripts: noexec (–n), verbose (–v), and xtrace (–x). The noexec (–n) option causes commands to be read without being executed and is used to check for syntax errors. The verbose (–v) option causes the input to displayed as it is read. The xtrace (–x) option causes commands in Korn shell scripts to be displayed as they are executed. This is the most useful, general debugging option. For example, tscript could be run in trace mode if invoked "ksh –x tscript".

Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.