mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Merge pull request #43 from mudge/patch-1
Solaris doesn't support readlink so use greadlink if available instead.
This commit is contained in:
commit
09291712ed
2 changed files with 10 additions and 2 deletions
|
@ -1,6 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
resolve_link() {
|
||||||
|
$(type -p greadlink readlink | head -1) $1
|
||||||
|
}
|
||||||
|
|
||||||
abs_dirname() {
|
abs_dirname() {
|
||||||
local cwd="$(pwd)"
|
local cwd="$(pwd)"
|
||||||
local path="$1"
|
local path="$1"
|
||||||
|
@ -8,7 +12,7 @@ abs_dirname() {
|
||||||
while [ -n "$path" ]; do
|
while [ -n "$path" ]; do
|
||||||
cd "${path%/*}"
|
cd "${path%/*}"
|
||||||
local name="${path##*/}"
|
local name="${path##*/}"
|
||||||
path="$(readlink "$name" || true)"
|
path="$(resolve_link "$name" || true)"
|
||||||
done
|
done
|
||||||
|
|
||||||
pwd
|
pwd
|
||||||
|
|
|
@ -12,6 +12,10 @@ if [ -z "$shell" ]; then
|
||||||
shell="$(basename "$SHELL")"
|
shell="$(basename "$SHELL")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
resolve_link() {
|
||||||
|
$(type -p greadlink readlink | head -1) $1
|
||||||
|
}
|
||||||
|
|
||||||
abs_dirname() {
|
abs_dirname() {
|
||||||
local cwd="$(pwd)"
|
local cwd="$(pwd)"
|
||||||
local path="$1"
|
local path="$1"
|
||||||
|
@ -19,7 +23,7 @@ abs_dirname() {
|
||||||
while [ -n "$path" ]; do
|
while [ -n "$path" ]; do
|
||||||
cd "${path%/*}"
|
cd "${path%/*}"
|
||||||
local name="${path##*/}"
|
local name="${path##*/}"
|
||||||
path="$(readlink "$name" || true)"
|
path="$(resolve_link "$name" || true)"
|
||||||
done
|
done
|
||||||
|
|
||||||
pwd
|
pwd
|
||||||
|
|
Loading…
Reference in a new issue