]> us-delaporte.pagekite.me Git - minion.git/blobdiff - bin/mp
Fix for bash octal
[minion.git] / bin / mp
diff --git a/bin/mp b/bin/mp
index 45291cbcb0ae9e03bbb4b93f7e06d4a8eb151304..160238e72a51c3081975bfc66f88a043bef1058d 100755 (executable)
--- a/bin/mp
+++ b/bin/mp
@@ -1,14 +1,27 @@
-#!/usr/bin/fish
-set year (date +%Y)
-set files $(find $HOME/Journal/$year -type f -iname "*$argv*\.md")
-
-if test (count $files) -lt 5;
-       for file in $files
-        mdtohtml $file > $file.html
-        firefox $file.html
-       end;
-else
-       echo "More than 5 files found."
-end
+#!/bin/bash
+# mp - minion print
+# Like `ml / minion list`, but gets the markdown file ready to print
+# Will act on a maximum of four files.
+# Creates .md.html files.
+# Opends files in your $BROWSER or assumes firefox
+year=`date +%Y`
+files=$(find $HOME/Journal/$year -type f -iname "*$1*\.md")
 
+if [ -z ${BROWSER} ]; then
+       echo "BROWSER unset, defaulting to Firefox"
+       export BROWSER=firefox
+fi
 
+counter=0
+for file in $files; do 
+       # echo $file
+       mdtohtml $file $file.html
+       $BROWSER $file.html &
+       counter=$((counter + 1))
+if [ $counter -gt 4 ]; then
+               echo "Aborting after 4 files."
+               echo "The following files would have been processed..."
+               echo $files
+               exit 1
+fi
+done