25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
687 B

13 년 전
13 년 전
  1. #!/usr/bin/env bash
  2. set -e
  3. resolve_link() {
  4. $(type -p greadlink readlink | head -1) $1
  5. }
  6. abs_dirname() {
  7. local cwd="$(pwd)"
  8. local path="$1"
  9. while [ -n "$path" ]; do
  10. cd "${path%/*}"
  11. local name="${path##*/}"
  12. path="$(resolve_link "$name" || true)"
  13. done
  14. pwd
  15. cd "$cwd"
  16. }
  17. libexec_path="$(abs_dirname "$0")"
  18. export PATH="${libexec_path}:${PATH}"
  19. command="$1"
  20. case "$command" in
  21. "" | "-h" | "--help" )
  22. echo -e "rbenv 0.2.0-pre\n$(rbenv-help)" >&2
  23. ;;
  24. * )
  25. command_path="$(command -v "rbenv-$command" || true)"
  26. if [ -z "$command_path" ]; then
  27. echo "rbenv: no such command \`$command'" >&2
  28. exit 1
  29. fi
  30. shift 1
  31. exec "$command_path" "$@"
  32. ;;
  33. esac