Reputation: 99960
I have this command:
rm -rf ~/.quicklock; echo $?
rm -rf ~/.quicklock; echo $?
rm -rf ~/.quicklock; echo $?
rm -rf ~/.quicklock; echo $?
always exits with 0, even if directory does not exist. I am on a Mac. I thought it would exit with 1 if the directory does not exist?
Upvotes: 5
Views: 1988
Reputation: 249093
rm -f
does not consider it to be an error if the file does not exist (nor if the directory does not exist, in the case of rm -rf
).
man rm
says about -f
or --force
:
ignore nonexistent files and arguments
Upvotes: 7