Consider the following shell script:
ping 8.asd.8.8 -c1 -q > /dev/null
if [ $? == 0 ]
then
echo 'ok'
else
echo 'erro'
fi
This ping will return an error and this error is handled in else
just below. But even using the -q
parameter the error returned by the ping is written on the screen:
ping: unknown host 8.asd.8.8
Is there any way to ignore this error? Show only the error handled by if
?