From b58155e6acb066776e2db32ce938f96b6333a452 Mon Sep 17 00:00:00 2001 From: Simone Sestito Date: Thu, 24 Nov 2022 21:51:33 +0100 Subject: [PATCH] Add Bash script to verify image URLs --- check-ingsw-photos.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 check-ingsw-photos.sh diff --git a/check-ingsw-photos.sh b/check-ingsw-photos.sh new file mode 100755 index 0000000..94b92a1 --- /dev/null +++ b/check-ingsw-photos.sh @@ -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