I'm working on refactoring some Python scripts intended to be run from the command line. The scripts use logging, which makes some messages be written to STDERR (among other things). I wonder if it's appropriate for a program in Linux to output to STDERR, but still return a zero (success) exit status. I thought that STDERR should only be consulted if the exit status is non-zero.
P.S. Basically I need to capture the output from the scripts, and send it to another service for processing, along with the exit status. I want the data to be consistent.
readbuiltin (at least in Bash, dash, ksh) writes its optional message to the user to standard error, a not-uncommon way to talk to the user in interactive scripts, and nevertheless returns0on success;ssh -vwrites debugging information on standard error and still returns0on success.ddis obliged to use stderr on completion, regardless of its exit status.