a is a symbolic link to
b. I am looking for a simple command to remove both
b at once that does not require me to know about
My current solution is
But maybe there's something easier?
Some systems will dereference the symlink when you add a trailing slash (at least if the symlink points to a directory):
The POSIX standard has changed a bit (see Pathname Resolution in IEEE Std 1003.1, 2004 Edition vs. IEEE Std 1003.1-2008), but it seems like the behavior for a pathname with a trailing slash and a final pathname components that is a symlink is (mostly) the same: the symlink is resolved.
Not all systems implement this behavior though (see comment by Gilles).