Dmitry V. Levin wrote:
Hi,
On Thu, Oct 07, 2004 at 12:03:48PM +0100, [EMAIL PROTECTED] wrote:
Suresh Krishnan wrote:
Thanks for the quick response. readlink -f does almost everything I
want. The only thing it does not do is to verify whether the path is
valid. I can add this on very easily in my script.
That got me thinking. If the path doesn't exist then
I think readlink -f should just return the canonicalized
path (the output from realpath). That would be more useful
that just stopping at the first invalid path component?
I.E. I think the output from the following should be
/usr/1/2/3 rather than /user/1
readlink -f /usr/share/../1/2/3
You are talking about some non-coreutils readlink utility.
I was talking about an older coreutils actually.
The extra canonicalize options were added on Jul 6 2004
http://savannah.gnu.org/cgi-bin/viewcvs/coreutils/coreutils/src/readlink.c
The readlink from coreutils works this way:
$ readlink --version |fgrep readlink
readlink (GNU coreutils) 5.3.0
Has this version been released?
$ readlink -f /usr/share/../1/2/3
$ readlink -v -f /usr/share/../1/2/3
readlink: /usr/share/../1/2/3: No such file or directory
$ readlink -v -e /usr/share/../1/2/3
readlink: /usr/share/../1/2/3: No such file or directory
$ readlink -v -m /usr/share/../1/2/3
/usr/1/2/3
Perfect, thanks!
Suresh, you can use just readlink to verify path validity now.
P�draig.
_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-coreutils