I have this:
ping -q xxx.xxx.xxx.xxx & disown; pingpid=$!
for run in {1..3}; do
sleep 5
stats+=$(kill -SIGQUIT $pingpid)
done
kill $pingpid
So basically I launch ping in background with -q option (to show just stats), get its PID and then execute a for
loop in which I want to store the intermediary stats of ping on each kill -SIGQUIT $pingpid
in a variable... that's 3 lines of stats, 5 seconds apart.
I can see the intermediary stats being printed to stdout but when I check the $stats
variable, I find it empty. I also tried with stderr redirection to stdout but I still can't get the variable to have the stats stored in it.