To force a command to return success, for example, an rm command that might fail but you don't care if it does, just add '|| :' to the end

rm nonexistantfile.txt || :

This will force an exit code of 0 (success).  If the rm fails, the shell will invoke the special built-in null utility ':', which will do nothing but exit successfully.

Community content is available under CC-BY-SA unless otherwise noted.