What does 1>&2 mean in shell?

This question already has an answer here:

  • echo that outputs to stderr 13 answers
  • In the shell, what does “ 2>&1 ” mean? 15 answers

  • That redirects the line "This script must be run as root" from standard out (STDOUT) to standard error output (STDERR).

    It's a easy way to print an error message to STDERR - this matters if you run the bash script from another script (like crontab), matters much less if you run it from the command line driectly since your terminal will show both STDOUT and STDERR.

    See also echo that outputs to stderr

    链接地址: http://www.djcxy.com/p/25586.html

    上一篇: Bash:2>&1是什么意思?

    下一篇: 1>&2在shell中的含义是什么?