Testing new curl command for url checks

This commit is contained in:
Alfred Gedeon 2021-02-10 13:37:29 -08:00
parent 630b3f6a2a
commit 962f735f2f

View file

@ -8,6 +8,7 @@ then
exit 2 exit 2
fi fi
USER_AGENT='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36'
SCRIPT_RET=0 SCRIPT_RET=0
set -o nounset # Treat unset variables as an error set -o nounset # Treat unset variables as an error
@ -27,7 +28,7 @@ function test {
for UNIQ_URL in ${!dict[@]} # loop urls for UNIQ_URL in ${!dict[@]} # loop urls
do do
CURL_RES=$(curl -I ${UNIQ_URL} 2>/dev/null| head -n 1 | cut -f 2 -d ' ') CURL_RES=$(curl -si --user-agent $(USER_AGENT) ${UNIQ_URL} 2>/dev/null| head -n 1 | cut -f 2 -d ' ')
RES=$? RES=$?
if [ "${CURL_RES}" == '' -o "${CURL_RES}" != '200' ] if [ "${CURL_RES}" == '' -o "${CURL_RES}" != '200' ]