In my shell script I got these lines:
rm tempfl.txt
rm tempfl2.txt
If these do not exist I get the error messages:
rm: temp
We can use 2> /dev/null to suppress the output error and || true to ensure a success exit status:
rm foo
=> rm: cannot remove ‘foo’: No such file or directory
rm foo 2> /dev/null
echo $?
=> 1
rm foo 2> /dev/null || true
echo $?
=> 0
If you are using the command in a shell script, makefile, etc, maybe you need this.