重定向 STDERR

2 是 STDERR。

$ echo_to_stderr 2>/dev/null # echos nothing

定义:

echo_to_stderr 是一个将 stderr 写入 STDERR 的命令

echo_to_stderr () {
    echo stderr >&2
}

$ echo_to_stderr
stderr