Commit c6a552e7 by Paul Mucur

Solaris doesn't come with readlink so use greadlink if available instead. (Taken…

Solaris doesn't come with readlink so use greadlink if available instead. (Taken from Ryan Tomayko's "GNU is killing Solaris", c.f. http://tomayko.com/writings/gnu-is-killing-solaris)
parent b1d097a8
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
set -E set -E
exec 3<&2 # preserve original stderr at fd 3 exec 3<&2 # preserve original stderr at fd 3
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"
...@@ -10,7 +14,7 @@ abs_dirname() { ...@@ -10,7 +14,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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment