diff options
Diffstat (limited to 'bin/latexmk')
| -rwxr-xr-x | bin/latexmk | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/latexmk b/bin/latexmk index 79d497e..520fe20 100755 --- a/bin/latexmk +++ b/bin/latexmk @@ -26,8 +26,22 @@ while getopts 1Rnh opt; do done shift $((OPTIND - 1)) +# http://stackoverflow.com/a/18443300/441757 +_realpath() { + OURPWD=$PWD + cd "$(dirname "$1")" + LINK=$(readlink "$(basename "$1")") + while [ "$LINK" ]; do + cd "$(dirname "$LINK")" + LINK=$(readlink "$(basename "$1")") + done + REALPATH="$PWD/$(basename "$1")" + cd "$OURPWD" + echo "$REALPATH" +} + if [ -n "${reexec}" ]; then - pdf=$(realpath "$(printf "%s" "$1" | sed 's/\.tex/\.pdf/')") + pdf=$(_realpath "$(printf "%s" "$1" | sed 's/\.tex/\.pdf/')") log() { if [ -n "${nocolor}" ]; then printf "%s!==>%s %s\n" "$(tput setaf 2)" "$(tput sgr0)" "$1" |