What is </dev/null in bash?

后端 未结 4 937
死守一世寂寞
死守一世寂寞 2020-11-30 22:58

In bash, standard (1) and error (2) output can be re-routed and discarded with:

>/dev/null 2>&1

But the following example does s

4条回答
  •  醉梦人生
    2020-11-30 23:30

    It is a way to close stdin, as if EOF (^D) were sent to it. It can be used as in this example with the mail command to signify it that the command should no more expect input from stdin.

    It is also often used to daemonize processes (Stop 6 of the recommended approach for creating well-behaved daemons)

提交回复
热议问题