On Tue, Aug 9, 2011 at 12:49 PM, Bob Proulx <b...@proulx.com> 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! jon.