Linux power tools and classic formats

This is an interesting one. I had a 200-pages book, and need a 50-page book, with 4 little pages on each page. So I based this script on psdim, one of a thousand linux power tools:
echo Must have installed psdim!
echo Converting...
gs -dBATCH -dNOPAUSE -sDEVICE=pswrite -sOutputFile=$1.tmp.ps $1
echo PSDIM output --------------------
psdim -$IMAGES $1.tmp.ps
echo PSDIM output end ----------------
pstops $(psdim -$IMAGES $1.tmp.ps) $1.tmp.ps $1.tm2.ps
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=$1.tiled.pdf $1.tm2.ps
rm $1.tmp.ps $1.tm2.ps
rename .pdf.tiled.pdf .tiled.pdf $1.tiled.pdf
echo Done!

You just need to start exploring GNU power tools now!