NavigationUser loginWho's onlineThere are currently 1 user and 15 guests online.
Online users
Highest Users
Linux NewsClick the above for your daily dose of Linux news. Food for ThoughtNot a nut or bolt shall reach Chile under Allende. Once Allende comes to power we shall do all within our power to condemn Chile and all Chileans to utmost deprivation and poverty. Spam?See spam posts on this site? If so, please don't reply to the spam! Instead, just report the URL to the webmaster. |
OT: symlinks questionOn Thu, May 31, 2007 at 09:01:44PM +0200, Jan Willem Stumpel wrote: Try: ln -s A --force mylink or Ken -- -- |
OT: symlinks question
Is there a single command to change the target of a symlink?
Say I have a link which points from mylink to A, made by
ln -s A mylink
and I want to make the link point to B instead. I can of course do
rm mylink
ln -s B mylink
but is't there a simpler way to do it? I would be amazed if there
weren't any (this operation occurs quite often), but I could not
find any clues in man ln.
Regards, Jan
--
OT: symlinks question
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thu, 31 May 2007 21:01:44 +0200
Jan Willem Stumpel wrote:
> Is there a single command to change the target of a symlink?
Try using the -f switch on ln.
- --
Andrew J. Barr
X-Mailer: Claws Mail 2.9.1 (GTK+ 2.10.12; powerpc-unknown-linux-gnu)
"The plural of anecdote is not evidence."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFGX0I3huM+Z62a52oRAl9uAKDsjEysLW2mHyWKqJ7pebmG+mF9EgCg3+LY
r9ON/7q7okXhEqrGPzaYD74=
=oo1R
-----END PGP SIGNATURE-----
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 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
--
OT: symlinks question
On Thu, May 31, 2007 at 09:01:44PM +0200, Jan Willem Stumpel wrote:
> Is there a single command to change the target of a symlink?
> Say I have a link which points from mylink to A, made by
>
> ln -s A mylink
>
> and I want to make the link point to B instead. I can of course do
>
> rm mylink
> ln -s B mylink
>
> but is't there a simpler way to do it? I would be amazed if there
> weren't any (this operation occurs quite often), but I could not
> find any clues in man ln.
>
Midnight commander lets you edit symlinks. However, I don't know how it
effects the change.
Doug.
--
OT: symlinks question
On 2007-05-31 21:01:44 +0200, Jan Willem Stumpel wrote:
> Is there a single command to change the target of a symlink?
>
> Say I have a link which points from mylink to A, made by
>
> ln -s A mylink
>
> and I want to make the link point to B instead. I can of course do
>
> rm mylink
> ln -s B mylink
>
> but is't there a simpler way to do it?
I've always used "ln -nfs B mylink". Never had any problem with this.
--
Vincent Lefèvre - Web:
100% accessible validated (X)HTML - Blog:
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
--