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:<
This will redirect the stderr (which is descriptor 2) to the file descriptor 1 which is the the stdout.
2>&1
Now when perform this you are redirecting the stdout to the file sample.s
myprogram > sample.s
Combining the two commands will result in redirecting both stderr and stdout to sample.s
myprogram > sample.s 2>&1
Redirect to /dev/null if you want to completely silent your application.
myprogram >/dev/null 2>&1