From Electron Cloud
Revision as of 13:40, 7 February 2008 by Ecloud (Talk | contribs) (New page: This came up when I was doing a lot of testing of some code that does printing; I wanted to print to PDF and then repeatedly view the output. But the CUPS PDF printer writes to /var/spool...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This came up when I was doing a lot of testing of some code that does printing; I wanted to print to PDF and then repeatedly view the output. But the CUPS PDF printer writes to /var/spool/cups-pdf/<username> by default, and I was naming the print jobs so they were different every time.

#!/bin/sh
echo -n $1
ls -t $1 | head -1

Usage:

xpdf `lsnewest /var/spool/cups-pdf/srutledge/`

The script should work whether you give it a directory as an argument, or if there is no argument, it will use the CWD.