如何避免在每个级别询问我是否要删除该路径?我只想删除路径中的所有内容?
答案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/