3 ms·
If I were to guess, how one might get into that habit is being annoyed by error messages: "cannot remove 'foo': is a directory" Just remove the darned object
by kazinator 6y ago
If I were to guess, how one might get into that habit is being annoyed by error messages:
"cannot remove 'foo': is a directory"
Just remove the darned object you're given as an argument using the appropriate implementation for its type.
"rm: remove write-protected regular file 'foo'?"
The rules are that if the directory is writable, the object can be deleted. Though you called stat to figure out it's a regular file, you didn't notice the link count: I have two more hard links to the file in the same directory, and one elsewhere. But, yes, unlink it.