Provide X-compatible find_binary function that finds a binary for a given command. Works with zsh/bash

This commit is contained in:
Nathan Broadbent
2012-11-17 11:41:08 +13:00
parent c46e165ca8
commit 0a797fb620
2 changed files with 14 additions and 10 deletions

View File

@@ -12,11 +12,15 @@ disable_nullglob() { if [ $shell = "zsh" ]; then unsetopt NULL_GLOB; else shopt
# Alias wrapper that ignores errors if alias is not defined.
_alias(){ alias "$@" 2> /dev/null; }
if [ $shell = "zsh" ]; then
export GIT_BINARY=$(type -p git | sed 's/git is //' | head -1)
else
export GIT_BINARY=$(type -P git)
fi
find_binary(){
if [ $shell = "zsh" ]; then
type -p "$1" | sed "s/$1 is //" | head -1
else
type -P "$1"
fi
}
export GIT_BINARY=$(find_binary git)
# Updates SCM Breeze from GitHub.
update_scm_breeze() {