Syntax:
     set output {"<filename>"}
     show output
The filename must be enclosed in quotes. If the filename is omitted, any output file opened by a previous invocation of set output will be closed and new output will be sent to STDOUT. (If you give the command set output "STDOUT", your output may be sent to a file named "STDOUT"! ["May be", not "will be", because some terminals, like x11 or wxt, ignore set output.])
When both set terminal and set output are used together, it is safest to give set terminal first, because some terminals set a flag which is needed in some operating systems. This would be the case, for example, if the operating system needs a separate open command for binary files.
On platforms that support pipes, it may be useful to pipe terminal output. For instance,
     set output "|lpr -Plaser filename"
     set term png; set output "|display png:-"
On MSDOS machines, set output "PRN" will direct the output to the default
printer.  On VMS, output can be sent directly to any spooled device.