When I use ping  foo.com I either get a response or ping: unknown host foo.com 
I am using this script to show custom responses 
status=$(ping -c 1 foo.com 2> /dev/null)
if [[ status -ne '200' ]]; then
     echo "site found"
    else
     echo "site not found" 
fi
the problem with the above is that, if site is found I get site found response, but if not instead of the error message, I get the default ping: unknown host foo.com
UPDATED.
declare -A websites 
websites=("" "")
    function ping_sites(){
        if [[ $1 != 'all' ]]; then 
            status=$(curl -I  --stderr /dev/null $1 | head -1 | cut -d' ' -f2)
            result=$(ping -c 1 $1 | grep 'bytes from' | cut -d = -f 4 | awk {'print $1'} 2> /dev/null)
            if [[ status -ne '200' ]]; then
                echo -e "$1  $c_red \t $status FAIL $c_none"
            else
                echo -e "$1  $c_green \t $status OK $c_none"
            fi
        else
          ... 
.
ping all 
ping foo.com
 
     
    