diff --git a/libexec/rbenv-commands b/libexec/rbenv-commands index a8c08def..3c570cff 100755 --- a/libexec/rbenv-commands +++ b/libexec/rbenv-commands @@ -26,7 +26,12 @@ elif [ "$1" = "--no-sh" ]; then shift fi -IFS=: read -d '' -r -a paths <<<"$PATH" || true +if [ "$(type -t readarray)" = "builtin" ]; then + readarray -d : -t paths < <(printf "%s" "$PATH") +else + # bash 3.x compatibility + IFS=: read -r -a paths <<<"$PATH" || true +fi shopt -s nullglob diff --git a/libexec/rbenv-help b/libexec/rbenv-help index 55ded829..cd30c22a 100755 --- a/libexec/rbenv-help +++ b/libexec/rbenv-help @@ -154,7 +154,12 @@ print_usage() { if [ "$1" = "--complete-commands" ]; then command_prefix="${2:-}" seen=() - IFS=: read -d '' -r -a paths <<<"$PATH" || true + if [ "$(type -t readarray)" = "builtin" ]; then + readarray -d : -t paths < <(printf "%s" "$PATH") + else + # bash 3.x compatibility + IFS=: read -r -a paths <<<"$PATH" || true + fi shopt -s nullglob for path in "${paths[@]}"; do for command in "${path}/rbenv-${command_prefix}"*; do