100 cases of the two scripts

Write a script to determine if a segment of all surviving hosts, and output up host
#! / Bin / bash

for i in {1..254}
do
{
ip=192.168.208.$i
ping -c1 -W1 $ip &>/dev/null
if [ $? -eq 0 ];then
echo $ip is up
fi
}&

DONE
the wait
echo "All Finished ..."
Summary: This is mainly a study of usage for the cycle to determine the usage of the host state and the background concurrently running scripts.

Guess you like

Origin blog.51cto.com/9447803/2403972