title: Pinging mutiple IP simultaneously using BASH
body: <p>I have a shell script in which I am trying to simultaneously  ping multiple IP's at the same time</p>
  
  <pre><code>#!/bin/sh
  
  #-------------------------------
  #Decleration of IP Address
  #-------------------------------
  
  IP_linux32='135.24.229.174'
  IP_linux64='135.24.228.128'
  IP_freeBSD32='135.24.228.104'
  IP_freeBSD64='135.24.228.129'
  DUMMY='135.24.229.0'
  
  count_linux32=$( ping -c2 -i5 $IP_linux32 |grep icmp* ) &amp;
  count_linux64=$( ping -c2 -i5 $IP_linux64 |grep icmp* ) &amp;
  count_freeBSD32=$( ping -c2 -i5 $IP_freeBSD32 |grep icmp* ) &amp;
  count_freeBSD64=$( ping -c2 -i5 $IP_freeBSD64 |grep icmp* ) &amp;
  dummy=$( ping -c2 -i5 $DUMMY |grep icmp* ) &amp;
  
  sleep 6
  
  if [[ ( "$count_linux32" -eq 0 &amp;&amp; "$count_linux64" -eq 0 ) ]]
   then
          echo "Linux is up"
   else
          echo "Linux not up"
  fi
  if [[ ( "$count_freeBSD32" -eq 0  &amp;&amp; "$count_freeBSD64" -eq 0 ) ]]
   then
          echo "BSD is up"
   else
          echo "BSD si not up"
  fi
  if [[ "$dummy" -eq 0 ]]
   then
          echo "Dummy is up"
   else
          echo "Dummy is not up"
  fi
  </code></pre>
  
  <p>The Dummy is false IP which should fail according to the code but still I am getting "Dummy is up" and not "Dummy is not up". </p>
  
  <p>Is there anything which I am doing wrong.</p>
  
  <p>I tried referring to lot of solutions but still I am not able to figure it out</p>