mirror of
https://github.com/rbenv/rbenv.git
synced 2024-12-29 13:15:42 +01:00
Use read -a
to split output into an array (#1450)
This commit is contained in:
parent
90c0357682
commit
8275e15cb0
8 changed files with 14 additions and 19 deletions
|
@ -20,7 +20,7 @@ elif [ "$1" = "--no-sh" ]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IFS=: paths=($PATH)
|
IFS=: read -d '' -r -a paths <<<"$PATH" || true
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,9 @@ export RBENV_VERSION
|
||||||
RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")"
|
RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")"
|
||||||
RBENV_BIN_PATH="${RBENV_COMMAND_PATH%/*}"
|
RBENV_BIN_PATH="${RBENV_COMMAND_PATH%/*}"
|
||||||
|
|
||||||
OLDIFS="$IFS"
|
IFS=$'\n' read -d '' -r -a scripts <<<"$(rbenv-hooks exec)" || true
|
||||||
IFS=$'\n' scripts=(`rbenv-hooks exec`)
|
|
||||||
IFS="$OLDIFS"
|
|
||||||
for script in "${scripts[@]}"; do
|
for script in "${scripts[@]}"; do
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$script"
|
source "$script"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ if [ -z "$RBENV_COMMAND" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IFS=: hook_paths=($RBENV_HOOK_PATH)
|
IFS=: read -r -a hook_paths <<<"$RBENV_HOOK_PATH"
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
for path in "${hook_paths[@]}"; do
|
for path in "${hook_paths[@]}"; do
|
||||||
|
|
|
@ -126,7 +126,8 @@ if [ -z "$no_rehash" ]; then
|
||||||
echo 'command rbenv rehash 2>/dev/null'
|
echo 'command rbenv rehash 2>/dev/null'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
commands=(`rbenv-commands --sh`)
|
IFS=$'\n' read -d '' -r -a commands <<<"$(rbenv-commands --sh)" || true
|
||||||
|
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
|
|
|
@ -160,11 +160,9 @@ remove_outdated_shims
|
||||||
registered_shims=( $(list_executable_names | sort -u) )
|
registered_shims=( $(list_executable_names | sort -u) )
|
||||||
|
|
||||||
# Allow plugins to register shims.
|
# Allow plugins to register shims.
|
||||||
OLDIFS="$IFS"
|
IFS=$'\n' read -d '' -r -a scripts <<<"$(rbenv-hooks rehash)" || true
|
||||||
IFS=$'\n' scripts=(`rbenv-hooks rehash`)
|
|
||||||
IFS="$OLDIFS"
|
|
||||||
|
|
||||||
for script in "${scripts[@]}"; do
|
for script in "${scripts[@]}"; do
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$script"
|
source "$script"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,9 @@ if [ -z "$RBENV_VERSION" ]; then
|
||||||
RBENV_VERSION="$(rbenv-version-file-read "$RBENV_VERSION_FILE" || true)"
|
RBENV_VERSION="$(rbenv-version-file-read "$RBENV_VERSION_FILE" || true)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OLDIFS="$IFS"
|
IFS=$'\n' read -d '' -r -a scripts <<<"$(rbenv-hooks version-name)" || true
|
||||||
IFS=$'\n' scripts=(`rbenv-hooks version-name`)
|
|
||||||
IFS="$OLDIFS"
|
|
||||||
for script in "${scripts[@]}"; do
|
for script in "${scripts[@]}"; do
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$script"
|
source "$script"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,9 @@ set -e
|
||||||
|
|
||||||
unset RBENV_VERSION_ORIGIN
|
unset RBENV_VERSION_ORIGIN
|
||||||
|
|
||||||
OLDIFS="$IFS"
|
IFS=$'\n' read -d '' -r -a scripts <<<"$(rbenv-hooks version-origin)" || true
|
||||||
IFS=$'\n' scripts=(`rbenv-hooks version-origin`)
|
|
||||||
IFS="$OLDIFS"
|
|
||||||
for script in "${scripts[@]}"; do
|
for script in "${scripts[@]}"; do
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$script"
|
source "$script"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,9 @@ if [[ ! -x "$RBENV_COMMAND_PATH" && -n "$GEM_HOME" && -x "${GEM_HOME}/bin/${RBEN
|
||||||
RBENV_COMMAND_PATH="${GEM_HOME}/bin/${RBENV_COMMAND}"
|
RBENV_COMMAND_PATH="${GEM_HOME}/bin/${RBENV_COMMAND}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OLDIFS="$IFS"
|
IFS=$'\n' read -d '' -r -a scripts <<<"$(rbenv-hooks which)" || true
|
||||||
IFS=$'\n' scripts=(`rbenv-hooks which`)
|
|
||||||
IFS="$OLDIFS"
|
|
||||||
for script in "${scripts[@]}"; do
|
for script in "${scripts[@]}"; do
|
||||||
|
# shellcheck disable=SC1090
|
||||||
source "$script"
|
source "$script"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue