so-un-bot/Utils/check-ingsw-photos.sh

17 lines
400 B
Bash
Executable file

#!/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