Save command output to variable without it printing to standard output

bash, linux

Solution

If you do not want to see the standard error, redirect it to `/dev/null`:

fpings=$(fping -c 1 -t 1 $ips 2>/dev/null | sort) 

Problem

I'm doing a bash script and I'm grabbing the output from this command: ``` fpings=$(fping -c 1 -t 1 $ips | sort) ``` The `fpings` variable does contain the output from the command, and the actual output of the command is not printed to the shell, but it still writes a line to the shell for each ip pinged. There is a switch (`-q`) to suppress the output (the part that I want) but not any to suppress the part I don't want. How do I get the result from the fpings command without it printing stuff to the shell?

Original source