Search This Blog

Wednesday 4 May 2016

Redirect script error and output messages to /dev/null

The syntax discussed below works with Bourne-like shells, such as sh, ksh, and bash:

$ command > /dev/null 2>&1  $ ./script.sh > /dev/null 2>&1  $ ./example.pl > /dev/null 2>&1

OR

command &>/dev/null  job arg1 arg2 &>/dev/null  /path/to/script arg1 &>/dev/null

No comments:

Post a Comment