bug-coreutils
[Top][All Lists]
Advanced

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

Re: rln, a potential new core util


From: Jim Meyering
Subject: Re: rln, a potential new core util
Date: Sun, 26 Feb 2006 12:22:01 +0100

Eric Blake <address@hidden> wrote:
> According to David Laurence Emerson on 2/21/2006 4:02 AM:
>> Hey all you wonderful GNU folks,
>>
>> I've written a utility that may be appropriate for future inclusion in the 
>> gnu
>> core utils.  It assists in the creation of relative-path symlinks, enabling
>> tab-completion in a number of cases where that fails for ln -s, and
>> preventing the creation of dead links.

Thanks for the suggestion.

>> For now, the tool is called "rln" ("r" is for relative).  I have attached the
>> decently-commented bash source for your amusement!  It seems to work pretty
>> well, though admittedly a c implementation would be much better.  For
>> convenience, I gave it a .txt extention and removed #!/bin/bash from the top
>> (so email clients will treat it as plain text).
>
> Rather than a new utility, have you considered adding a new command-line
> option to the existing ln that gives the same semantics?  Something like:
>
> $ ln --help
> ...
>    --make-relative  implies -s, creates relative symlinks in
>                     DIRECTORY pointing to existing TARGETs
> ...
> $ cd /a/b/c/d/e
> $ ln -v --make-relative E2 E4 E6 /a
> create relative symbolic link `/a/E2' to `E2'
> create relative symbolic link `/a/E4' to `E4'
> create relative symbolic link `/a/E6' to `E6'
> $ for f in /a/E? ; do echo -n "$f: "; readlink $f ; done
> /a/E2: b/c/d/e/E2
> /a/E4: b/c/d/e/E4
> /a/E6: b/c/d/e/E6
> $
>
> Even so, I'm not sure this will be accepted as part of coreutils without a
> patch to the C implementation of ln, lots of good documentation, and test
> cases; and even then, without a good argument why this extension is essential.

Enough people have requested this functionality over the years that I'm
willing to add it now, maybe as ln --relative.  I have to admit that
it'd be a useful complement to the functionality you get when using ln
to create hard links: i.e., you don't have to worry about whether the
working directory happens to be in the source or destination (or some
other) directory.




reply via email to

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