Mounting /bin/echo

I stumbled across this trick getting a printer to work on AIX. AIX uses a command called enq to submit jobs to its printing subsystem. For compatibility reasons it also includes commands like 'lp' and 'lpr' for submitting print jobs.

Typically one might send 'report.txt' to printer called 'mylp1' with the command:

lpr -P mylp1 report.txt

To find out what the underlying enq command receives mount it to /bin/echo

mount /bin/echo /bin/enq

Now running the lpw command above sends the enq parameter to /bin/echo which displays:

-P mylp1 -c -Bgn report.txt

Remember to unmount /bin/enq to make your printer work again.