Add bash & zsh compatible way to resolve abs exe paths

This commit is contained in:
Wilhelmina Drengwitz
2017-02-07 21:20:17 -05:00
committed by Willa Drengwitz
parent 6143b31a11
commit 77916f056a

View File

@@ -21,6 +21,13 @@ fi
source "$scmbDir/test/support/test_helper.sh"
source "$scmbDir/lib/scm_breeze.sh"
bin_path() {
if [ -n "${ZSH_VERSION:-}" ];
then where "$@" | tail -1
else which "$@"
fi
}
# Setup
#-----------------------------------------------------------------------------
oneTimeSetUp() {
@@ -35,10 +42,10 @@ oneTimeSetUp() {
# Before aliasing, get original locations so we can compare them in the test
unalias mv rm sed cat 2>/dev/null
export mv_path="$(which mv)"
export rm_path="$(which rm)"
export sed_path="$(which sed)"
export cat_path="$(which cat)"
export mv_path="$(bin_path mv)"
export rm_path="$(bin_path rm)"
export sed_path="$(bin_path sed)"
export cat_path="$(bin_path cat)"
# Test aliases
alias mv="nocorrect $mv_path"