The beauty of command-line applications is that they all have the same simple interface, as shown in the following figure. They can read from standard input (STDIN) and write to standard output (STDOUT). When something goes wrong, they sometimes write to standard error (STDERR). In addition to using those three streams, command-line applications can accept arguments on the command line, which in Ruby end up in the ARGV constant. Consider the following command:
|||cp foo.txt bar.txt|
Here, the two command-line arguments foo.txt and bar.txt are passed to the cp command-line application.
When a command-line application is done ...