What is /bin/true?

后端 未结 6 932
谎友^
谎友^ 2020-12-24 00:29

On a Linux system, what is /bin/true? What is it used for?

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-24 00:41

    /bin/true is a command that returns 0 (a truth value in the shell).

    Its purpose is to use in places in a shell script where you would normally use a literal such as "true" in a programming language, but where the shell will only take a command to run.

    /bin/false is the opposite that returns non-zero (a false value in the shell).

提交回复
热议问题