]> apps.delaporte.us Git - minion.git/blob - bin/mpp
Fix for bash octal
[minion.git] / bin / mpp
1 #!/bin/bash
2 # mpp - minion print to PDF
3 # Like `ml / minion list`, but gets the markdown file ready to print
4 # Will act on a maximum of four files.
5 # Requires ~/Journal/journal.css for styling.
6 # Creates .md.pdf files.
7 year=`date +%Y`
8 files=$(find $HOME/Journal/$year -type f -iname "*$1*\.md")
9
10 JOURNAL_CSS=$HOME/Journal/journal.css
11 if [ ! -f $JOURNAL_CSS ]; then
12 echo "Please create a CSS file at $JOURNAL_CSS and retry."
13 exit 1
14 fi
15
16 counter=0
17 for file in $files; do
18 # echo $file
19 md2pdf -i $file -o $file.pdf -c $JOURNAL_CSS
20 counter=$((counter + 1))
21 if [ $counter -gt 4 ]; then
22 echo "Aborting after 4 files."
23 echo "The following files would have been processed..."
24 echo $files
25 exit 1
26 fi
27 done