dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit d5102f33a8cc41c43b8822965713a8f0a60f481b
parent 32774c14adad661948bf3e2a7f87e3eb12ee278f
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 29 Jun 2020 16:46:26 +0200

Improve error messages and fix natbib bibliography file detection

Diffstat:
M.local/bin/compile | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/.local/bin/compile b/.local/bin/compile @@ -14,7 +14,7 @@ show_help() { } die() { - printf '%s\n' "$1" >&2 + printf '%s: error: %s\n' "${0##*/}" "$1" >&2 exit 1 } @@ -24,8 +24,10 @@ regeximatch() { extract_tex_include() { d="$(grep -v ".*%.*\\${2}" "$1" | - sed -nE "/.*\\${2}\[*.*\]*{([^}]*)}.*/{ s//\1/;p; }")" - #tr '\n' ' ')" + sed -nE "/.*\\${2}\[*.*\]*\{([^}]*)\}.*/{ s//\1/;p; }")" + if [ "$2" = "bibliography" ] && [ -n "$d" ]; then + d="${d%.bib}.bib" + fi [ -n "$d" ] && printf '%s\n' "$d" || : } @@ -137,7 +139,7 @@ while :; do break ;; -?*) - die 'Error: Unknown option specified' + die 'unknown option specified' ;; *) # No more options break