Update.
authorFrancois Fleuret <francois@fleuret.org>
Fri, 17 May 2013 12:33:44 +0000 (14:33 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Fri, 17 May 2013 12:33:44 +0000 (14:33 +0200)
bashrc

diff --git a/bashrc b/bashrc
index ef555d6..0b09ca9 100644 (file)
--- a/bashrc
+++ b/bashrc
@@ -104,7 +104,7 @@ alias rm='rm -i'
 alias mv='mv -i'
 # alias chmod='chmod -v'
 alias chmod='chmod -c'
-alias cp='cp -i'
+alias cp='cp -i -v'
 alias rd=rmdir
 alias md='mkdir -v'
 alias ps='ps uxaf'
@@ -180,16 +180,22 @@ function latexdiff () {
 # corresponding tex file
 
 function rl () {
-    RECENT_LOG=$(find -maxdepth 1 -name "*.log" -type f | head -1)
+    RECENT_LOG=$(ls -t $(find -maxdepth 1 -name "*.log" -type f) | head -1)
+
     if [[ ${RECENT_LOG} ]]; then
-        FILE=${RECENT_LOG/.log/}
-        pdflatex ${FILE}
-        bibtex ${FILE}
-        pdflatex ${FILE}
-        pdflatex ${FILE}
-        if [[ "$1" == "--xpdf" ]]; then
-            xpdf ${FILE}.pdf
+        FILEBASE="${RECENT_LOG/.log/}"
+
+        pdflatex "${FILEBASE}"
+        bibtex "${FILEBASE}"
+        pdflatex "${FILEBASE}"
+        pdflatex "${FILEBASE}"
+
+        if [[ "$1" == "--view" ]]; then
+            xpdf "${FILEBASE}.pdf"
+        elif [[ "$1" == "--print" ]]; then
+            lpr "${FILEBASE}.pdf"
         fi
+
     else
         echo "Can not find a recent log." >&2
         return 1