From 5d1aa1fd3b6c8a003dd3789791a349f34a0b0c14 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 17 May 2013 14:33:44 +0200 Subject: [PATCH] Update. --- bashrc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/bashrc b/bashrc index ef555d6..0b09ca9 100644 --- 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 -- 2.20.1