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?
The exit status
($?)
of the dig command does not reflect whether the zone transfer was successful or not.We could check the output file for the error message like that: