portable realpath

Eric gyre-Ja3L+HSX0kI at public.gmane.org
Tue Dec 13 11:37:58 UTC 2011


On Tue, 13 Dec 2011, Antonio Sun wrote:

> 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.
>
> Any suggestions?
>
> PS. 'readlink -f', will canonicalize by  following  every symlink in every
> component of the given name recursively.

What about:

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

What is happening on FreeBSD, v8.2-RELEASE-p4, with 'readlink -f'?


-- 
Eric.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list