rm -r path :如何避免在每个级别被询问?

rm -r path :如何避免在每个级别被询问?

如何避免在每个级别询问我是否要删除该路径?我只想删除路径中的所有内容?

答案1

-I如果您只想提示一次,可以使用switch:

rm -rI sampledir/

man rm

-I     prompt once before removing more than three files, or when removing recursively.
       Less intrusive than -i, while still giving protection against most mistake

并用于-f“无提示”:

-f, --force
       ignore nonexistent files and arguments, never prompt

所以:

rm -rf sampledir/

相关内容