On Fri, Jul 29, 2011 at 11:37:48AM -0400, Greg Troxel wrote: > > a) Create a file A > > b) Create a symlink X->A > > c) Create a hard link Y=X > > d) Unlink a > > e) Create a directory A
Here is what happens. The semantics are really different. $ touch A $ ln -s A X $ ln X Y $ unlink A $ mkdir A $ ls -lid A X Y 1135709 drwxrwxr-x 2 manu manu 4096 jui 29 20:33 A 1135711 lrwxrwxrwx 2 manu manu 1 jui 29 20:33 X -> A 1135711 lrwxrwxrwx 2 manu manu 1 jui 29 20:33 Y -> A $ uname Linux $ cd /tmp $ touch A $ ln -s A X $ ln X Y $ unlink A $ mkdir A $ ls -lid A X Y 672129 drwxr-xr-x 2 manu wheel 512 Jul 29 20:35 A 533126 lrwxr-xr-x 1 manu wheel 1 Jul 29 20:35 X -> A 533109 -rw-r--r-- 1 manu wheel 0 Jul 29 20:35 Y $ uname NetBSD > > a) Create a symlink X-A', where A' doesn't exist > > b) Create a hard link Y=X > > c) Create a directory A $ ln -s A X $ ln X Y $ mkdir A $ ls -lid A X Y 1135711 drwxrwxr-x 2 manu manu 4096 jui 29 20:38 A 1135709 lrwxrwxrwx 2 manu manu 1 jui 29 20:38 X -> A 1135709 lrwxrwxrwx 2 manu manu 1 jui 29 20:38 Y -> A $ uname Linux $ rm -Rf A X Y $ ln -s A X $ ln X Y ln: X: No such file or directory $ uname NetBSD > Is there some way in Linux to change the symlink target and have both > (hardlinked) source names point to the new target? Here is my attempt: $ touch A B $ ln -s A X $ ln X Y $ ln -sf B X $ ls -lid A B X Y 1135709 -rw-rw-r-- 1 manu manu 0 jui 29 20:40 A 1135711 -rw-rw-r-- 1 manu manu 0 jui 29 20:40 B 1135719 lrwxrwxrwx 1 manu manu 1 jui 29 20:41 X -> B 1135717 lrwxrwxrwx 1 manu manu 1 jui 29 20:40 Y -> A -- Emmanuel Dreyfus m...@netbsd.org