Please consider the following commands:
cd /
mkdir -p ~/a/b
touch ~/a/content
# Removes dir 'b' and stops at 'a' because it's non-empty.
# (This is the expected behavior.)
rmdir -p --ignore-fail-on-non-empty ~/a/b
rm ~/a/content
mkdir -p ~/a/b
# Fails with error: "rmdir: failed to remove directory '/home/myhome'".
rmdir -p --ignore-fail-on-non-empty ~/a/b
Why does rmdir
fail at the last step? Why does it try to delete the non-empty $HOME
instead of stopping?