Hi all,
Sorry if this seems too basic.
But is there a way to overwrite the target of a symbolic link without first deleting the symlink itself?
For example, if I have this:
public_html -> releases/b2b-20080228
... and there's a new update, I can then just do the following:
$ ln releases/site-latest public_html
I tried using the -f option but it doesn't seem to work as expected.
On Wed, Mar 05, 2008 at 07:20:50AM +0800, Matt Arnilo S. Baluyos (Mailing Lists) alleged:
Hi all,
Sorry if this seems too basic.
But is there a way to overwrite the target of a symbolic link without first deleting the symlink itself?
For example, if I have this:
public_html -> releases/b2b-20080228
... and there's a new update, I can then just do the following:
$ ln releases/site-latest public_html
I tried using the -f option but it doesn't seem to work as expected.
Your example doesn't have -s? I assume that was a typo?
Anyways, ln -sf does exactly what you describe.
$ ls -l foo lrwxrwxrwx 1 garrick rds 3 Mar 4 15:24 foo -> bar $ ln -sf bar2 foo $ ls -l foo lrwxrwxrwx 1 garrick rds 4 Mar 4 15:24 foo -> bar2
On 05/03/2008, Garrick Staples garrick@usc.edu wrote:
On Wed, Mar 05, 2008 at 07:20:50AM +0800, Matt Arnilo S. Baluyos (Mailing Lists) alleged:
Hi all,
Sorry if this seems too basic.
But is there a way to overwrite the target of a symbolic link without first deleting the symlink itself?
For example, if I have this:
public_html -> releases/b2b-20080228
... and there's a new update, I can then just do the following:
$ ln releases/site-latest public_html
I tried using the -f option but it doesn't seem to work as expected.
Your example doesn't have -s? I assume that was a typo?
Anyways, ln -sf does exactly what you describe.
$ ls -l foo lrwxrwxrwx 1 garrick rds 3 Mar 4 15:24 foo -> bar $ ln -sf bar2 foo $ ls -l foo lrwxrwxrwx 1 garrick rds 4 Mar 4 15:24 foo -> bar2
Hi,
Sorry. That was a typo.
I have just tried using a target as a file and it does seem to work with the -f option. It's only when the target is a directory that it fails:
$ ll drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir1 drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir2 lrwxrwxrwx 1 matt matt 4 Mar 4 14:35 link -> dir1
$ ln -s dir2 link
$ ll drwxrwxr-x 2 matt matt 4096 Mar 4 14:35 dir1 drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir2 lrwxrwxrwx 1 matt matt 4 Mar 4 14:35 link -> dir1
On 05/03/2008, Matt Arnilo S. Baluyos (Mailing Lists) matt.baluyos.lists@gmail.com wrote:
On 05/03/2008, Garrick Staples garrick@usc.edu wrote:
On Wed, Mar 05, 2008 at 07:20:50AM +0800, Matt Arnilo S. Baluyos (Mailing Lists) alleged:
Hi all,
Sorry if this seems too basic.
But is there a way to overwrite the target of a symbolic link without first deleting the symlink itself?
For example, if I have this:
public_html -> releases/b2b-20080228
... and there's a new update, I can then just do the following:
$ ln releases/site-latest public_html
I tried using the -f option but it doesn't seem to work as expected.
Your example doesn't have -s? I assume that was a typo?
Anyways, ln -sf does exactly what you describe.
$ ls -l foo lrwxrwxrwx 1 garrick rds 3 Mar 4 15:24 foo -> bar $ ln -sf bar2 foo $ ls -l foo lrwxrwxrwx 1 garrick rds 4 Mar 4 15:24 foo -> bar2
Hi,
Sorry. That was a typo.
I have just tried using a target as a file and it does seem to work with the -f option. It's only when the target is a directory that it fails:
$ ll drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir1 drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir2 lrwxrwxrwx 1 matt matt 4 Mar 4 14:35 link -> dir1
$ ln -s dir2 link
That should be:
$ ln -sf dir2 link
Early morning here. :)
Matt Arnilo S. Baluyos (Mailing Lists) wrote:
On 05/03/2008, Matt Arnilo S. Baluyos (Mailing Lists) matt.baluyos.lists@gmail.com wrote:
On 05/03/2008, Garrick Staples garrick@usc.edu wrote: I have just tried using a target as a file and it does seem to work with the -f option. It's only when the target is a directory that it fails:
$ ll drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir1 drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir2 lrwxrwxrwx 1 matt matt 4 Mar 4 14:35 link -> dir1
$ ln -s dir2 link
That should be:
$ ln -sf dir2 link
from the ln man page:
-n, --no-dereference treat destination that is a symlink to a directory as if it were a normal file
Cheers, Michael
On 05/03/2008, Michael D. Kralka michael.kralka@kvs.com wrote:
Matt Arnilo S. Baluyos (Mailing Lists) wrote:
On 05/03/2008, Matt Arnilo S. Baluyos (Mailing Lists) matt.baluyos.lists@gmail.com wrote:
On 05/03/2008, Garrick Staples garrick@usc.edu wrote:
I have just tried using a target as a file and it does seem to work with the -f option. It's only when the target is a directory that it fails:
$ ll drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir1 drwxrwxr-x 2 matt matt 4096 Mar 4 14:34 dir2 lrwxrwxrwx 1 matt matt 4 Mar 4 14:35 link -> dir1
$ ln -s dir2 link
That should be:
$ ln -sf dir2 link
from the ln man page:
-n, --no-dereference treat destination that is a symlink to a directory as if it were a normal file
Great! Working now. Thanks.
I've read the man page but didn't understand that option to be what I'm looking for.