This is a card in Dave's Virtual Box of Cards.
                
            
            
            The flexibility of STDOUT
Page created: 2023-06-21Up to scripts
Lately, I’ve been having most of my command-line programs write directly to STDOUT, even if I intend for the output to end up in a file.
Here’s why, in the form of a list:
- 
You can debug by viewing and filtering the output immediately 
- 
Less code (don’t worry about opening a file and handling permissions, etc.) 
- 
You can easily wrap the program in a shell script that writes to a file 
- 
The output can be used with other tools 
A really fun example of this is my cgi-local-dynamic on-the-fly generation of page content from source from the same tool I wrote for static site generation.