trash
trash copied to clipboard
-f exits with non-zero error code
I don't know if it's intentional or not, but trash (unlike rm) exits with a non-zero error code for non-existent files when using it with the -f flag.
The man-page for rm says the following for the -f-flag:
If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error.
Example:
$ rm -f imaginary-file && echo "done"
done
$ trash -f imaginary-file && echo "done"
trash: imaginary-file: path does not exist
This is indeed problematic!