_realcommand: Try greadlink before readlink (Alioth: #313659).

Some systems' readlink does not have -f, but may have the GNU readlink
which does installed as greadlink.
master
Ville Skyttä 2012-05-30 23:56:58 +03:00
parent 739c6d2833
commit 32f223963a
2 changed files with 4 additions and 0 deletions

View File

@ -1274,6 +1274,8 @@ _realcommand()
type -P "$1" > /dev/null && {
if type -p realpath > /dev/null; then
realpath "$(type -P "$1")"
elif type -p greadlink > /dev/null; then
greadlink -f "$(type -P "$1")"
elif type -p readlink > /dev/null; then
readlink -f "$(type -P "$1")"
else

View File

@ -799,6 +799,8 @@ proc realcommand {cmd} {
if [string length [set path [auto_execok $cmd]]] {
if {[string length [auto_execok realpath]]} {
set result [exec realpath $path]
} elseif {[string length [auto_execok greadlink]]} {
set result [exec greadlink -f $path]
} elseif {[string length [auto_execok readlink]]} {
set result [exec readlink -f $path]
} else {