-I
如果只想提示一次,可以使用switch:
rm -rI sampledir/
Run Code Online (Sandbox Code Playgroud)
来自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
Run Code Online (Sandbox Code Playgroud)
并-f
用于“无提示”:
-f, --force
ignore nonexistent files and arguments, never prompt
Run Code Online (Sandbox Code Playgroud)
所以:
rm -rf sampledir/
Run Code Online (Sandbox Code Playgroud)