Bet you don’t know what >&- does? According to Jeff @ stackoverflow:

/your/first/command >&- 2>&-

Be careful to note the order: >&- closes stdout, which is what you want to do; &>- redirects stdout and stderr to a file named - (hyphen), which is not what what you want to do. It’ll look the same at first, but the latter creates a stray file in your working directory. It’s easy to remember: >&2 redirects stdout to descriptor 2 (stderr), >&3 redirects stdout to descriptor 3, and >&- redirects stdout to a dead end (i.e. it closes stdout).

This is one way for quieting commands. The other, more common method (and better solution), is /dev/null:

echo "Hello?" > /dev/null

For output redirection to a file, you can direct EVERY output file descriptor to the same place very concisely, but only in bash:

/your/first/command &> /dev/null

and the one everyone loves (silence all output):

/im/just/a/command > /dev/null 2>&1

Enjoy your scripting!

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.