When will os.remove fail?

Lele Gaifax lele at metapensiero.it
Tue Mar 14 10:57:13 EDT 2017


Jon Ribbens <jon+usenet at unequivocal.eu> writes:

>>        Otherwise,  if  a file is unwritable, standard input is a terminal, and
>>        the -f or --force  option  is  not  given,  or  the  -i  or  --interac‐
>>        tive=always  option is given, rm prompts the user for whether to remove
>>        the file.  If the response is not affirmative, the file is skipped.
>
> Yes, this describes the behaviour if you specify -I or -i,
> as I mentioned - not if you don't specify either of those options.

English is not my native language, but that's not how I understand that
paragraph: if -i is given, it always ask, regardless the writable bit,
otherwise it does when f is readonly and no -f is given.

I think Chris is right, consider:

$ rm --version
rm (GNU coreutils) 8.26

$ which rm
/bin/rm

$ alias | grep rm | wc -l
0

$ ls -l *file*
-rw-rw-r-- 1 lele lele 0 Mar 14 15:52 myfile
-r-------- 1 lele lele 0 Mar 14 15:52 myfile2
-rw-r--r-- 1 root root 0 Mar 14 15:52 othersfile

$ rm myfile

$ rm myfile2
rm: remove write-protected regular empty file 'myfile2'? y

$ rm othersfile
rm: remove write-protected regular empty file 'othersfile'? y

$ ls -l *file*
ls: cannot access '*file*': No such file or directory

my 0.02€
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.




More information about the Python-list mailing list