重定向 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