...next to the return value of wget you can also check the size of the output file (see 'man test' and increase mana for using 'mktemp'):
Code:
goNoGo() { _TMPFILE=`mktemp -p /tmp wget.XXXXXXXXXX` && {
wget -q $1 -O > "${_TMPFILE}"; RETVAL=$?
[ $RETVAL -ne 0 ] && return 1
[ -s "${_TMPFILE}" ] && return 1
rm -f "${_TMPFILE}"; }
}
Use like:
Code:
goNoGo $REPO_URL && do operation
*Caveats: checking wget exists (subst cURL, elinks -dump, etc, etc) plus the result could still be a
malformed repo file...