I want to change the destination of an existing symbolic link, without removing the link or the old destination.
I have previously created a symbolic link to a directory such as follows :
$ cd /usr/lib/jvm/
$ ls -lh
drwxr-xr-x 8 uucp 143 4.0K Sep 10 20:22 jdk1.7.0_04
drwxr-xr-x 8 uucp 143 4.0K Aug 29 05:42 jdk1.7.0_07
$ sudo ln -s jdk1.7.0_04 oracle-jdk-7
$ ls -lh
drwxr-xr-x 8 uucp 143 4.0K Sep 10 20:22 jdk1.7.0_04
drwxr-xr-x 8 uucp 143 4.0K Aug 29 05:42 jdk1.7.0_07
lrwxrwxrwx 1 root root 12 May 11 11:27 oracle-jdk-7 -> jdk1.7.0_04/
Now I want to change this, to link to the other directory :
$ sudo ln --force -s jdk1.7.0_07 oracle-jdk-7
But it doesn't work without any errors :
$ ls -lh
drwxr-xr-x 8 uucp 143 4.0K Sep 10 20:36 jdk1.7.0_04
drwxr-xr-x 8 uucp 143 4.0K Aug 29 05:42 jdk1.7.0_07
lrwxrwxrwx 1 root root 12 May 11 11:27 oracle-jdk-7 -> jdk1.7.0_04/
Any help ?
sudo ln -s jdk1.7.0_04/ oracle-jdk-7
. Note the slash after04
.