How to silence output in a Bash script?

后端 未结 9 2066
离开以前
离开以前 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条回答
  •  旧时难觅i
    2020-11-29 17:53

    All output:

    scriptname &>/dev/null
    

    Portable:

    scriptname >/dev/null 2>&1
    

    Portable:

    scriptname >/dev/null 2>/dev/null
    

    For newer bash (no portable):

    scriptname &>-
    

提交回复
热议问题