Subject: Re: bug#45700: rm should not prompt if ! isatty(2)

From: Paul Eggert <[email-masked]>
Date: Wed, 6 Jan 2021 11:16:57 -0800

On 1/6/21 10:56 AM, John Wiersba via GNU coreutils Bug Reports wrote:
> $ touch asdf && chmod a-w asdf && rm asdf 2>&1 | catrm: remove write-protected regular empty file 'asdf'?          # should*not*  prompt
> 
> If the prompt cannot be seen, then it can't be properly answered, so there is no point in prompting and consequently leaving the user with a hanging command and no way to know what's being expected of them.  Instead rm should attempt to remove the file and succeed or fail based on the result.

POSIX requires the current behavior; see clause 3 in:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html

Although GNU rm needn't follow POSIX blindly, it's doubtful that rm 
should remove the file in this particular case, as the longstanding 
tradition is that plain "rm" does not remove unwriteable files without 
more confirmation.

Since you know about "rm -f" I suggest using that (that's what everyone 
else does...).