Crombie Tools
backupslides.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 ##
4 # @file backupslides.sh
5 #
6 # Creates backup slides using all of the pdf images
7 # in the local figs directory.
8 #
9 # @author Daniel Abercrombie
10 #
11 
12 option=$1
13 
14 figs=figs
15 
16 if [ ! -d $figs ]
17 then
18  echo "You have no $figs directory here!" >&2
19  exit 10
20 fi
21 
22 destination=backup_slides.tex
23 > $destination
24 
25 for found in `find $figs -name "*.pdf" | rev | sort | rev`
26 do
27  f=${found##$figs/}
28 
29  if grep $f *.tex > /dev/null && [ "$option" != "all" ]
30  then
31  continue
32  fi
33 
34  title=${f%%.pdf}
35  echo "\begin{frame}" >> $destination
36  echo " \frametitle{\small ${title//_/\\_}}" >> $destination
37  echo " \centering" >> $destination
38  echo " \includegraphics[width=0.6\linewidth]{$f}" >> $destination
39  echo "\end{frame}" >> $destination
40  echo "" >> $destination
41 done