This question is old, but you could do this, which facilitates reading:

>&2 echo "error"

The operator '>&2' literally means redirect the address of file descriptor 1 (stdout) to the address of file descriptor 2 (stderr) for that command. depending on how deeply you want to understand it, read this: http://wiki.bash-hackers.org/howto/redirection_tutorial

To avoid interaction with other redirections use subshell

(>&2 echo "error")

相关文章:

  • 2021-04-27
  • 2021-09-26
  • 2021-12-28
  • 2021-08-03
  • 2022-12-23
  • 2022-01-29
  • 2021-10-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-12-05
  • 2021-09-14
  • 2022-01-21
相关资源
相似解决方案