mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
6938692ca2
/usr/bin/env seems to have problems with arguments to bash on some platforms. To bypass this, use set -e instead.
30 lines
547 B
Bash
Executable file
30 lines
547 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
find_version_file() {
|
|
local root="$(pwd)"
|
|
while [ -n "$root" ]; do
|
|
if [ -e "${root}/.rbenv-version" ]; then
|
|
echo "${root}/.rbenv-version"
|
|
return 0
|
|
fi
|
|
root="${root%/*}"
|
|
done
|
|
return 1
|
|
}
|
|
|
|
DEFAULT_PATH="${HOME}/.rbenv/default"
|
|
|
|
find_default_version_file() {
|
|
if [ -e "$DEFAULT_PATH" ]; then
|
|
echo "$DEFAULT_PATH"
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
if [ -z "$RBENV_VERSION" ]; then
|
|
find_version_file || find_default_version_file || true
|
|
else
|
|
echo "RBENV_VERSION environment variable"
|
|
fi
|