( cmd; cat file; cmd ) | cmd

Rather special example: This was useful for me on a Redhat Linux, where man(1) otherwise annoyingly

would intersperse the output with headers and footers for a print version, which is rarely used, though...

I tried: ( echo -e ".pl 1100i"; cat "$1"; echo ".pl \

(nlu+10

" ) | tbl | nroff -man

Another example: If your bc(1) cannot be made to default to some decimal digits (Tom Rodman, in comp.unix.shell)

_bc() { { echo "scale=4"; cat;}|bc -l;}

or bc() { { echo "scale=4"; cat;}|command bc -l;} if you like

Another example via hackernews: a commandline "webserver":