I'm trying to check if a file in the url exists or not using wget
, but the result it is giving is not as expected.
It is giving the result as Spider mode enabled. Check if remote file exists.
The command I'm using is:
cd $path
if [ $? -eq 0 ]; then
touch laber.txt
if [ $? -eq 0 ]; then
echo $key >> laber.txt
if [ $? -eq 0 ]; then
wget -S --spider $url/laber.txt 2>&1 | grep -q 'HTTP/1.0 200 OK'
if [ $? -eq 0 ]; then
echo OK;
else
rm -r laber.txt
echo FAIL;
fi
else
echo 'test';
fi
else
echo '3';
fi
else
echo '4';
fi