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
As the other answers state, you can use command 2> /dev/null
to throw away the error output from command
But what is going on here?
>
is the operator used to redirect output. 2
is a reference to the standard error output stream, i.e. 2>
= redirect error output.
/dev/null
is the 'null device' which just swallows any input provided to it. You can combine the two to effectively throw away output from a command.
Full reference:
> /dev/null
throw away stdout1> /dev/null
throw away stdout2> /dev/null
throw away stderr&> /dev/null
throw away both stdout and stderr