From 9423c7a66f9cff46413c3c715bfb72893f6c5ac4 Mon Sep 17 00:00:00 2001 From: anntnzrb Date: Sun, 5 Jul 2020 12:01:13 -0500 Subject: [PATCH] Prevent user-defined aliases/commands checking Adding `[ -x ]` also checks if the command is an executable; if this check is skipped, then user-defined aliases will interfere and validate the condition (unintended). --- .local/bin/compiler | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/compiler b/.local/bin/compiler index 213013ed..ac3b8451 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -32,9 +32,9 @@ case "$ext" in go) go run "$file" ;; h) sudo make install ;; m) octave "$file" ;; - md) if command -v lowdown >/dev/null; then + md) if [ -x "$(command -v lowdown)" ] >/dev/null; then lowdown -d nointem -e super "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf - elif command -v groffdown >/dev/null; then + elif [ -x "$(command -v groffdown)" ] >/dev/null; then groffdown -i "$file" | groff > "$base.pdf" else pandoc "$file" --pdf-engine=xelatex -o "$base".pdf