[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: equivalent of Linux readlink -f in pure bash?

From: Jon Seymour
Subject: Re: equivalent of Linux readlink -f in pure bash?
Date: Tue, 9 Aug 2011 13:24:54 +1000

On Tue, Aug 9, 2011 at 12:49 PM, Bob Proulx <address@hidden> wrote:
> Jon Seymour wrote:
>> Has anyone ever come across an equivalent to Linux's readlink -f that
>> is implemented purely in bash?
>> (I need readlink's function on AIX where it doesn't seem to be available).
> Try this:
>  ls -l /path/to/some/link | awk '{print$NF}'
> Sure it doesn't handle whitespace in filenames but what classic AIX
> Unix symlink would have whitespace in it?  :-)

readlink -f will fully resolve links in the path itself (rather than
link at the end of the path), which was the behaviour I needed.

It seems cd -P does most of what I need for directories and so
handling things other than directories is a small tweak on that.

Anyway, thanks for that!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]