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'
# 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