Check return codes of any functions called (e.g. opening or closing a file) and provide a diagnostic message for anomalous results together with the error code(s).

For warnings, diagnostics, and information about how the script is working etc. use STDERR. For the output that is the purpose of the script use STDOUT so the output can be piped to another process.

  • No labels