If you want to run Tidy from a Perl, bash, or other scripting language you may find it of value to inspect the result returned by Tidy when it exits:
- 0 = if everything is fine
- 1 = if there were warnings and
- 2 = if there were errors.
Example Perl script
1 if (close(TIDY) == 0) {
2 my $exitcode = $? >> 8;
4 printf STDERR "tidy issued warning messages\n";
5 } elsif ($exitcode == 2) {
6 printf STDERR "tidy issued error messages\n";
8 die "tidy exited with code: $exitcode\n";
11 printf STDERR "tidy detected no errors\n";