11.4. Debugging Scripts

TC shell scripts often fail due to some simple syntax error or logic error. Options to the tcsh command are provided to help you debug your programs. See Table 11.3.

Table 11.3. echo (-x) and verbose (-v)
As options to tcsh
tcsh -x scriptname Display each line of script after variable substitution and before execution.
tcsh -v scriptname Display each line of script before execution, just as you typed it.
tcsh -n scriptname Interpret but do not execute commands.
As arguments to the set command
set echo Display each line of script after variable substitution and before execution.
set verbose Display each line of script before execution, just as you typed it.
As the first line in a script
#!/bin/tcsh -xv Turn ...

Get Linux Shells by Example 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.