Bug 6048: printoverdues.sh bash odities
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 7 Apr 2011 15:08:48 +0000 (17:08 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Fri, 7 Oct 2011 01:14:53 +0000 (14:14 +1300)
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Note: this script really needs a rewrite, but this patch does fix up the
things it's supposed to fix up.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
misc/cronjobs/printoverdues.sh

index 99bb878..51bb30f 100755 (executable)
@@ -27,20 +27,24 @@ then
 fi
 if [[ -n $2 && -f $2 ]]
 then
-    set $optpisa "--css $2";
+    optpisa="--css $2";
 fi
 if [[ -n $3 ]]
 then
-    set $optprinter "-h $3";
+    optprinter="-h $3";
 fi
 if [[ -n $4 ]]
 then
-    set $optprinter "$optprinter -d $4";
+    optprinter="$optprinter -d $4";
 fi
 for i in $1/*.html
 do
-    xhtml2pdf $optpisa  $i
+    xhtml2pdf $optpisa  $i;
 done
-lp $optprinter  $1/*.pdf
-tar cvfz $directory`date "+%Y%m%d"`.tar.gz  $directory
-rm -rf $directory
+
+if [[ -n $optprinter ]]
+then
+    lp $optprinter  $1/*.pdf;
+fi
+
+tar cvfz $directory`date "+%Y%m%d"`.tar.gz  $directory;