Write to terminal after redirecting stdout to a file without using stderr?

前端 未结 2 1381
别跟我提以往
别跟我提以往 2020-12-16 23:14

I have two shell scripts, one that serves as the main \"program\" and another that serves as a \"library.\"

In several places in the \"program,\" I\'ll do something

2条回答
  •  有刺的猬
    2020-12-16 23:50

    Open /dev/tty on another FD.

    exec 0< /dev/null
    exec 1> /dev/null
    exec 2> /dev/null
    exec 3> /dev/tty
    echo 'Hello, World!' >&3 
    

提交回复
热议问题