[Top][All Lists]

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

Re: `readlink -f` and trailing slash

From: Pádraig Brady
Subject: Re: `readlink -f` and trailing slash
Date: Tue, 04 Sep 2012 12:21:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

On 08/29/2012 12:23 AM, Todd Partridge wrote:
I was wondering if this be possible to define because I see people use
it `readlink -f` to discover the full path a number of times.  When
using `readlink -f` it prints the full path; however, if one enters
the full path with a trailing slash on a directory, it does not
include the trailing slash.  I think it would be good for a couple
programs one of which is `rsync`.  Using a trailing slash with rsync
for the source directory would copy the contents of the directory,
without it the directory itself is copied.  Seems to me that there was
another program that did this too.  Would it be possible to append a
trailing slash to `readlink -f` for those that specify that when then
type it?  e.g. `readlink -f libtool/` would return
`/usr/share/libtool/` rather than `/usr/share/libtool`.  Just a
thought, but be very very nice.

Thank you for you work on coreutils.

Another case where a trailing / is significant
is when dealing with symlinks to directories.

But since we know readlink (or the newer realpath)
will never return a trailing /, it's easy to
modify scripts to append a '/' like:

  canon_path=$(realpath "$path")/

So while the need is there,
I don't think this needs a new option.


reply via email to

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