----- Forwarded message from Luke-Jr luke@dashjr.org ----- Notes: In "Quote variables with caution", it says to use square brackets, and then goes on to give a correct example with curly braces. "Stop piping cats" only refers to piping to grep, but in reality there's almost never a good reason to pipe a single-file cat. The < operator provides a file on standard input. So "cat foo | wc -l" can become "wc -l < foo"
An easy to see case where 'cat' is truly the easiest way...
(cat /tmp/header; date; uptime;cat - /tmp/signature) | \ mail -s 'A case where cat is needed' kclug@kclug.org
The ( ) pair spawns s sub-shell which allows multiple commands to share the same input, output, and error streams.
In this case I used 'date' and 'uptime' along with a second 'cat'.
The second 'cat' reads from stdin (standard in) till it sees EOF (End Of File <Control-D>) and then follows that with the /tmp/signature file.
Stdout of all those commands is sent to stdin of the 'mail' command.