removing symbolic link target
I'm sorry if this is a duplicate, but most of the posts I could find on this subject pertains to removing a symbolic link.
I have 2 symbolic links
current -> /home 1.3
previous -> /oldhome 1.2
I have a bash script that copies the current to the previous. Before I do that though I want to remove the previous. I don't want to just remove the link. I also want to remove the target of the link. The problem is that I don't know where the previous link is pointing to because it's a versioned directory and I won't know what the version is within the script.
If deleting the links target isn't possible, I can solve this problem if anyone can tell me how to print out what the link is pointing to.
I've just discovered readlink which returns the directory it's pointing to. With that I can solve my issue, but I'd still like to know if deleting a symbolic link's target through the link is possible.
For example (I know this doesn't work)
returns: /oldhome 1.2
Thank you for any help.
Last edited by bilyboy65; 06-08-2012 at 03:59 PM.
Reason: partial solution