I want to retrieve all connected hosts with a script:
for i in {1..9}
do
ping -c 1 -w 1 8.8.8.$i | grep ' 0%'
done
So i want to add a condition using if, which would test if the output of each ping (with the piped grep) is empty or not, if it's not empty then host is up.
Cheers
p.s: i would like to avoid the use of a file