I have script like this
CHARSET=ASCII dig domain.com AXFR > domain.com.zone
if [ "$?" = "0" ]; then
echo "OK"
else
echo "Something went wrong"
fi
However, I saw there is non complete file with line at the end
;; communications error: end of file
Is there some bug in my script or how I can "catch" this error?