#!/bin/bash
-UNPAPER_PATH="/Users/dja/Applications/unpaper-0.3/"
-PATH=$UNPAPER_PATH:$PATH
-
function usage {
cat >&2 << __EOF__
Usage: $0 [-vfpsmut] [-d depth] pdffile outdir
__EOF__
}
+## Setup and utilities ##
+# Unpaper
+UNPAPER_PATH="/home/wheel/dja/public-html/scandal/unpaper-0.3/bin"
+PATH=$UNPAPER_PATH:$PATH
+
+# Mac OS X doesn't have seq. It has jot instead.
+Linux_seq="seq"
+Darwin_seq="jot -"
+if [[ $(uname) == "Darwin" ]]; then my_seq=$Darwin_seq;
+else my_seq=$Linux_seq;
+fi;
+
-# process for -f flag to forceably redo all conversions
+## Process flags ##
forcepdf=
forcemask=
forceunpaper=
rm $dscname
# process pages 1 by 1 to avoid convert gobbling all the memory
-for pg in `jot - 1 $pages`; do
+for pg in `$my_seq 1 $pages`; do
echo "Processing page $pg."
pgn=$(printf '%03d' $pg)