How to hide command output in Bash

后端 未结 7 1428
天涯浪人
天涯浪人 2020-12-02 05:42

I want to make my Bash scripts more elegant for the end user. How do I hide the output when Bash is executing commands?

For example, when Bash executes



        
7条回答
  •  不知归路
    2020-12-02 06:08

    You can redirect stdout to /dev/null.

    yum install nano > /dev/null

    Or you can redirect both stdout and stderr,

    yum install nano &> /dev/null.

    But if the program has a quiet option, that's even better.

提交回复
热议问题