portable realpath

Antonio Sun antoniosun-N9AOi2cAC9ZBDgjK7y7TUQ at public.gmane.org
Tue Dec 13 16:59:10 UTC 2011


Thanks Eric,

Anyone knows a portable way to get realpath, ie, the canonical file name of
>> a symbolic link?
>>
>> Both GNU Linux and NetBSD seem to support 'readlink -f', but the '-f' will
>> fail in FreeBSD, v8.2-RELEASE-p4 at least.
>>
>> What is happening on FreeBSD, v8.2-RELEASE-p4, with 'readlink -f'?


$ readlink -f /tmp
readlink: illegal option -- f
usage: readlink [-n] [file ...]

What about:
>
>  perl -le 'use Cwd; print Cwd::realpath("tmp")'
>

Yep, that works.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20111213/e670c4fa/attachment.html>


More information about the Legacy mailing list