From: Daniel Axtens Date: Mon, 28 Mar 2011 10:24:31 +0000 (+0800) Subject: linux compat X-Git-Url: https://git.ucc.asn.au/?p=dja%2Fscandal.git;a=commitdiff_plain;h=5769da90e7cef4fb5fe6ca0538925f74492a860d linux compat --- diff --git a/scan2pages.sh b/scan2pages.sh index 12f5670..ce588f7 100755 --- a/scan2pages.sh +++ b/scan2pages.sh @@ -1,8 +1,5 @@ #!/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 @@ -20,8 +17,20 @@ OPTIONS: __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= @@ -84,7 +93,7 @@ echo "Got $pages page(s)." 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)