linux compat
authorDaniel Axtens <dja@ucc.asn.au>
Mon, 28 Mar 2011 10:24:31 +0000 (18:24 +0800)
committerDaniel Axtens <dja@ucc.asn.au>
Mon, 28 Mar 2011 10:24:31 +0000 (18:24 +0800)
scan2pages.sh

index 12f5670..ce588f7 100755 (executable)
@@ -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)

UCC git Repository :: git.ucc.asn.au