Am 5. Juli 2017 01:07:21 MESZ schrieb Steve Litt <slitt@???>:
> echo 'quit' | nc -w2 $1 $2 2>/dev/null 1>/dev/null
For these kind of tests I use "nc -z $HOST $PORT". Like your suggestion, it not only proves the host to be up, but also the wanted service and times out after a couple of seconds, too - but you don't need the "> /dev/null 2>&1" redirection.