i need check status of some link listen in a file called paths.txt, i have write a simple for loop but not work
for LINK in $(cat paths.txt)
do
CURL="$(curl -I $LINK 2>/dev/null | head -n 1 | cut -d$' ' -f2)"
if [ "${CURL}" = "200" ]
then
echo ${LINK} >> true.txt
else
echo ${LINK} >> false.txt
fi
done
If i launch the curl command from terminal i read the right status, instead if i make an echo of CURL variable i not have any output
CURL="$(curl -I $LINK 2>/dev/null | head -n 1 | cut -d$' ' -f2)", doecho $LINK. Do you get the proper content of your file ?echo -e "\n$LINK\n"and show correctly all link sepatared by line*or?) in the URLs?