How to silence output in a Bash script?

后端 未结 9 2062
离开以前
离开以前 2020-11-29 17:15

I have a program that outputs to stdout and would like to silence that output in a Bash script while piping to a file.

For example, running the program will output:<

9条回答
  •  甜味超标
    2020-11-29 17:50

    Note: This answer is related to the question "How to turn off echo while executing a shell script Linux" which was in turn marked as duplicated to this one.

    To actually turn off the echo the command is:

    stty -echo

    (this is, for instance; when you want to enter a password and you don't want it to be readable. Remember to turn echo on at the end of your script, otherwise the person that runs your script won't see what he/she types in from then on. To turn echo on run:

    stty echo

提交回复
热议问题