Merge pull request #3944 from bukzor/command-not-which
/usr/bin/which -> type -P
This commit is contained in:
commit
08db242ccd
@ -114,10 +114,10 @@ EOS
|
||||
if [[ -x "/usr/bin/shasum" ]]
|
||||
then
|
||||
sha="$(/usr/bin/shasum -a 256 "$CACHED_LOCATION" | cut -d' ' -f1)"
|
||||
elif [[ -x "$(which sha256sum)" ]]
|
||||
elif [[ -x "$(type -P sha256sum)" ]]
|
||||
then
|
||||
sha="$(sha256sum "$CACHED_LOCATION" | cut -d' ' -f1)"
|
||||
elif [[ -x "$(which ruby)" ]]
|
||||
elif [[ -x "$(type -P ruby)" ]]
|
||||
then
|
||||
sha="$(ruby <<EOSCRIPT
|
||||
require 'digest/sha2'
|
||||
|
||||
@ -85,10 +85,10 @@ fi
|
||||
|
||||
case "$(lowercase "$SCM_FILE")" in
|
||||
git)
|
||||
[[ -n "$HOMEBREW_GIT" ]] && safe_exec "$(which "$HOMEBREW_GIT")" "$@"
|
||||
[[ -n "$HOMEBREW_GIT" ]] && safe_exec "$(type -P "$HOMEBREW_GIT")" "$@"
|
||||
;;
|
||||
svn)
|
||||
[[ -n "$HOMEBREW_SVN" ]] && safe_exec "$(which "$HOMEBREW_SVN")" "$@"
|
||||
[[ -n "$HOMEBREW_SVN" ]] && safe_exec "$(type -P "$HOMEBREW_SVN")" "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -99,7 +99,7 @@ brew_repo_version="$(quiet_safe_cd "$SCM_DIR/../../../../bin" && pwd -P)/$SCM_FI
|
||||
safe_exec "$brew_repo_version" "$@"
|
||||
|
||||
IFS=$'\n'
|
||||
for path in $(/usr/bin/which -a "$SCM_FILE" 2>/dev/null)
|
||||
for path in $(type -aP "$SCM_FILE")
|
||||
do
|
||||
if [[ "$path" != "/usr/bin/$SCM_FILE" ]]
|
||||
then
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
POD2MAN="$(/usr/bin/which pod2man5.18 ||
|
||||
/usr/bin/which pod2man5.16 ||
|
||||
/usr/bin/which pod2man5.12 ||
|
||||
/usr/bin/which "$HOMEBREW_PREFIX/opt/pod2man/bin/pod2man" ||
|
||||
POD2MAN="$(type -P pod2man5.18 ||
|
||||
type -P pod2man5.16 ||
|
||||
type -P pod2man5.12 ||
|
||||
type -P "$HOMEBREW_PREFIX/opt/pod2man/bin/pod2man" ||
|
||||
echo /usr/bin/pod2man)"
|
||||
exec "$POD2MAN" "$@"
|
||||
|
||||
@ -39,13 +39,13 @@ _create_lock() {
|
||||
local name="$2"
|
||||
local ruby="/usr/bin/ruby"
|
||||
local python="/usr/bin/python"
|
||||
[[ -x "$ruby" ]] || ruby="$(which ruby 2>/dev/null)"
|
||||
[[ -x "$python" ]] || python="$(which python 2>/dev/null)"
|
||||
[[ -x "$ruby" ]] || ruby="$(type -P ruby)"
|
||||
[[ -x "$python" ]] || python="$(type -P python)"
|
||||
|
||||
if [[ -x "$ruby" ]] && "$ruby" -e "exit(RUBY_VERSION >= '1.8.7')"
|
||||
then
|
||||
"$ruby" -e "File.new($lock_fd).flock(File::LOCK_EX | File::LOCK_NB) || exit(1)"
|
||||
elif [[ -x "$(which flock 2>/dev/null)" ]]
|
||||
elif [[ -x "$(type -P flock)" ]]
|
||||
then
|
||||
flock -n "$lock_fd"
|
||||
elif [[ -x "$python" ]]
|
||||
|
||||
@ -32,7 +32,7 @@ setup-ruby-path() {
|
||||
then
|
||||
HOMEBREW_RUBY_PATH="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby"
|
||||
else
|
||||
HOMEBREW_RUBY_PATH="$(which ruby)"
|
||||
HOMEBREW_RUBY_PATH="$(type -P ruby)"
|
||||
fi
|
||||
|
||||
if [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user