Redirecting STDERR

Download bash eBook

Example

2 is STDERR.

$ echo_to_stderr 2>/dev/null # echos nothing

Definitions:

echo_to_stderr is a command that writes "stderr" to STDERR

echo_to_stderr () {
    echo stderr >&2
}

$ echo_to_stderr
stderr

Stats

Contributors: 1
2016-04-08
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook