Re: OT: symlinks question
Andrew J. Barr wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thu, 31 May 2007 21:01:44 +0200
> Jan Willem Stumpel <jstumpel@planet.nl> wrote:
>
>> Is there a single command to change the target of a symlink?
>
> Try using the -f switch on ln.
Thanks! I had seen the -f switch in the ln man page, but hadn't
tried it because it says
-f, --force
remove existing destination files
I somehow thought from this that the file itself would be removed
(instead of just the destination part of the link).
The text in the man page should be read as:
override the target part of an existing link,
if it points to an ordinary file
.. because, sadly, and somewhat illogically, ln -sf does *not*
override an existing target if it is a directory! So for this case
it it back to "remove old link; create new link".
Regards, Jan
Reply to: