The following function allows to test for the existens of a server in the network via ping, but with a better interface
#!/bin/sh
 
# --------------------------------------------------------- #
function server_exists ()
{
	# ping Optionen:
	# -c : Anzahl von pings
	# -n : nur numerisch, keine DNS Abfragen
	TESTSERVER=$1
	if (ping -c 1 -n -w 2 $TESTSERVER > /dev/null 2>&1) ; then
		# echo "$TESTSEVER: ping ok" 		
		return 0   # Success.		
	else
		# echo "$TESTSEVER: ping nicht ok" 
		return 1   # Failed 
	fi
}
It can be used as
if (server_exists $SERVER); then
	echo "> Rechner '$SERVER' existiert"
fi