From fb374fc81b89ee9005365ffd527d7768c2e9a49c Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sat, 6 Aug 2016 19:37:51 +0200 Subject: [PATCH] brew-run: Include ax-common using latest example code This fixes some shellcheck(1) warnings, and enhances the replacement functions when ax-common wasn't found. --- cmd/brew-run | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cmd/brew-run b/cmd/brew-run index a7104c9..e304efd 100755 --- a/cmd/brew-run +++ b/cmd/brew-run @@ -1,20 +1,17 @@ #!/bin/sh -# 2016-01-06, alex@barton.de +# 2016-08-06, alex@barton.de # Include "ax-common.sh": +ax_common_sourced= for dir in "$HOME/lib" "$HOME/.ax" /usr/local /opt/ax /usr; do [ -z "$ax_common_sourced" ] || break ax_common="${dir}/lib/ax/ax-common.sh" - [ -r "$ax_common" ] && source "$ax_common" + # shellcheck source=/usr/local/lib/ax/ax-common.sh + [ -r "$ax_common" ] && . "$ax_common" done if [ -z "$ax_common_sourced" ]; then - function ax_msg() { - echo "$2" - } - function ax_abort() { - ax_msg - "$@" - exit 1 - } + ax_msg() { shift; echo "$@"; } + ax_abort() { ax_msg - "$@"; exit 1; } fi unset dir ax_common ax_common_sourced -- 2.39.2