Determine if output is stdout or stderr

There are only three ways I know of to determine what a program will output to STDOUT and what to STDERR

  1. Read the documentation. Or

  2. Experiment with redirection†

  3. print STDERR in red

†For example:

program > program.stdout 2> program.stderr

Then look at the two output files to see what the program has written to STDOUT and what it has written to STDERR.

Instead of redirection you can pipe to tee if you need output to continue to the screen as well as into a file. See https://stackoverflow.com/q/692000/477035


Based on your commented request:

{ { command; } 2>&3 | sed 's/^/STDOUT: /'; } 3>&1 1>&2 | sed 's/^/STDERR: /'