codehaven - php snippets - coding help
Generic filters
Exact matches only
  • How to stop errors showing in output – Terminal – Command line

    21st December 2014


    Raspberrypi - Codehaven

    By adding

    If you don’t specify a number then the standard output stream is assumed but you can also redirect errors

    > file redirects stdout to file
    1> file redirects stdout to file
    2> file redirects stderr to file
    &> file redirects stdout and stderr to file

    We used 2>/dev/null, so it gets error output and redirects the stderr to file, in this case a null file!

    /dev/null is the null device it takes any input you want and throws it away. It can be used to suppress any output.

    Was this code snippet helpful?