Atum Tenório

Sobre as coisas que para aí andam e nos caem à frente.

quinta-feira, fevereiro 05, 2009

nota: break and print




#!/bin/bash

filename=$1

if [[ -z "$filename" ]]; then
echo No file
exit
fi

totpages=$(pdfinfo $filename | grep ^Pages | sed 's/Pages:[[:space:]]*//')

echo $totpages

exit

start=1
end=`expr $start + 3`

while [ $end -lt $totpages ]; do

echo "Doing pages :: " $start - $end

printme=$$out$start-$end.pdf

pdftk A=$filename cat A$start-$end output $printme && \
lpr -P hp2200 $printme

start=`expr $end + 1`
end=`expr $start + 3`

sleep 30

done

echo $start $totpages

rm -f $$out*

exit 0



sacana da impressora...