Can i redirect any command to dev null?


i have bash script and my question is if i can with peace of mind point any bash command into dev null? ( >/dev/null )

because i cant veriffy there are any errors or it really executed command. respectivelly how i can veriffy it, any advice? thx

/dev/null is like a black hole … anything you chuck in there will disappear never to be seen again … it’s function isn’t to see if something ran “properly”, that’s more what clever use of exit codes (or indeed output) is for :wink:

It’s not really possible to give methods for testing a command or script without knowing its contents, and what you expect it to do.

You could check if your last command executed with errors or not:

#Your Last command...
if [ "${RC}" -ne "0" ]; then
       # run with errors or failed
       # your debug code here