Quote:
Originally Posted by wjevans_7d1@yahoo.co
The closest I can get to a single command is a single command line:
Code:
rm $(ls -l yoursymboliclink | sed -e 's/^.* -> //'); rm yoursymboliclink
And even that won't be adequate if you want to go through an arbitrary number of symbolic links, where x might be a symbolic link to y which is a symbolic link to a regular file z.
|
I was thinking down the same lines, but your semicolon cheats because it makes two commands

. Here is how to make yours one command:
Code:
rm $(ls -l yoursymboliclink | sed -e 's/^.* -> //') yoursymboliclink
Here is my contribution:
Code:
rm $(ls -l yoursymboliclink | awk '{print $11}') yoursymboliclink
Writing a bash script to recursively navigate a "link points to link points to link" situation is still difficult because a completely different chain of links could ultimately point to the target file (or any of its links) and end up a broken link when the file or link gets removed.