Skip to content

Commit

Permalink
_realcommand: Try greadlink before readlink (Alioth: #313659).
Browse files Browse the repository at this point in the history
Some systems' readlink does not have -f, but may have the GNU readlink
which does installed as greadlink.
  • Loading branch information
scop committed May 30, 2012
1 parent 739c6d2 commit 32f2239
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/lib/library.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 32f2239

Please sign in to comment.