I'm using macOS with rm
tool from GNU coreutils (not macOS’s own rm
).
So I have a script where I clean up some directory like this:
if [ -d "${cleanup_repo_clone_root}" ]; then
echo "Cleaning up tmp directory: ${cleanup_repo_clone_root}"
set -x; rm -rf -- "${cleanup_repo_clone_root}"
fi
I threw a set -x
in there to see what's happening.
It's showing me output:
+ set -x
+ rm -rf -- /var/folders/h7/n46zg3md4l57vzsgxcs355/T/tmp.eizQw1iNBQ
rm: cannot remove '/var/folders/h7/n46zg3md4l57vzsgxcs355/T/tmp.eizQw1iNBQ': Directory not empty
but if I copy paste that rm command and execute it, it works fine!
$ rm -rf -- /var/folders/h7/n46zg3md4l57vzsgxcs355/T/tmp.eizQw1iNBQ
What is happening here?