Add Bash script to verify image URLs

This commit is contained in:
Simone Sestito 2022-11-24 21:51:33 +01:00
parent a235b97b48
commit b58155e6ac
No known key found for this signature in database
GPG key ID: 1754E03A4BEBD761

17
check-ingsw-photos.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
SEARCHDIR="./Ingegneria del Software/"
echo "Invalid URLs:"
for img in `grep "img" "$SEARCHDIR" -R | sed -E 's/^(.*?)\.txt\:img\=//'`; do
img=$(echo "$img"|tr -d '\n'|tr -d '\r')
curl -I "$img" 2>/dev/null | \
grep -i "Content-Type: image/" >/dev/null
if [ "$?" -ne 0 ]; then
(
cd "$SEARCHDIR"
grep "$img" . -R
)
fi
done