Subject: rm -I vs. rm --interactive=once
From: Daniel Rudolf <[email-masked]>
To: [email-masked]
Date: Tue, 16 Aug 2011 01:31:06 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

according to the --help message and the manual of rm, the parameters
"-I" and "--interactive=once" should be absolutely identical. But when
you're deleting an unwritable file with parameter "-I", rm does not
prompt for this file. When you're using "--interactive=once" rm is
prompting.

> $ touch file1 && chmod -w file1
> $ touch file2 && touch file3 && touch file4
> $ ls -l
> insgesamt 0
> -r--r--r-- 1 daniel daniel 0 2011-08-16 00:52 file1
> -rw-r--r-- 1 daniel daniel 0 2011-08-16 00:57 file2
> -rw-r--r-- 1 daniel daniel 0 2011-08-16 00:57 file3
> -rw-r--r-- 1 daniel daniel 0 2011-08-16 00:57 file4
> $ LC_ALL=C rm --interactive=once file1 file2 file3 file4
> rm: remove all arguments? y
> rm: remove write-protected regular empty file `file1'? y
> $
As you can see rm prompts for the unwritable file "file1".

> $ touch file1 && chmod -w file1
> $ touch file2 && touch file3 && touch file4
> $ LC_ALL=C rm -I file1 file2 file3 file4
> rm: remove all arguments? y
> $
Now rm does not prompt for the unwritable file "file1".

This also happens if you're deleting "file1" only.

My system:
$ LC_ALL=C rm --version
rm (GNU coreutils) 7.4
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
and Jim Meyering.
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 10.04.3 LTS
Release:	10.04
Codename:	lucid
$ uname -a
Linux HP-Pavilion-Ubuntu 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11
08:03:28 UTC 2010 x86_64 GNU/Linux

Greetings,

Daniel Rudolf