why below statement do not ask for confirmation while using option i or I for rm ?
// pass aggregated
find . -name $name -type d -exec rm -irf {} \;
// pass each
find . -name $name -type d -exec rm -irf {} +
The -i
option asks for confirmation but the -f
option which follows in your command overrides it, turning off the confirmation dialog.
Observe:
$ rm -fri file1
rm: remove regular empty file 'file1'? n
$ rm -irf file1
$
If the first form above, -f
appears first and -i
latter. Consequently, -i
overrides -f
and rm
asks for confirmation.
In the second form above, -i
appears first and -f
latter. In this case, -f
overrides and no confirmation dialog appears.
From man rm
:
-f, --force
ignore nonexistent files and arguments, never prompt-i
prompt before every removal-I
prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes
-f
. The option -i
provides more protection than -I
. If you are using -i
, then find ...\;
and find ...+
are both equally safe with the later being more computationally efficient.