You can use realpath like this:
rm $(realpath A)
Setting up an example:
$ cd $(mktemp -d)
$ pwd
/tmp/tmp.QwSuHKmWwE
$ touch C
$ ln -s C B
$ ln -s B A
$ stat -c "%N" *
`A' -> `B'
`B' -> `C'
`C'
Showing that realpath does what you want:
$ realpath A
/tmp/tmp.QwSuHKmWwE/C
So running rm $(realpath A) is like running rm C.
$ rm $(realpath A)
$ stat -c "%N" *
`A' -> `B'
`B' -> `C'
Or did you want to remove all three files?
In that case, I think you'll have to write a script.
Here's something that should do the job:
#!/bin/bash
if test $# -eq 0; then
echo "Usage: dellinks.sh <file>..." 1>&2
exit 2
fi
if ! type readlink >/dev/null 2>&1; then
echo "dellinks.sh: cannot find readlink program" 1>&2
exit 1
fi
for file in "$@"; do
while test -L "$file"; do
target="$(readlink "$file")"
rm "$file"
file="$target"
done
if test -e "$file"; then
rm "$file"
fi
done
Example:
$ stat -c "%N" *
`A' -> `B'
`B' -> `C'
`C'
$ ~/bin/dellinks.sh
Usage: dellinks.sh <file>...
$ ~/bin/dellinks.sh A
$ stat -c "%N" *
stat: cannot stat `*': No such file or directory
rm -rf Aonly removes A, not B. – Mikel Feb 12 '11 at 23:55