Quick question. Currently using this to get header expiry info.
wget -O /dev/null -S $1 2>&1 | grep -q -m 1 "Expires: Sun, 19 Nov 1978 05:00:00 GMT" && echo "Yes" || echo "No"
With execution via " ./is-drupal www.URL.com
"
How could I iterate through an array in a text document that would be like
www.URL1.com
www.URL2.com
www.URL3.com
etc.
Then if the value returned "Yes" it would save the Yes URLs to a new text file.
Your best input is greatly appreciated!
#!/bin/bash
while read -r line; do
wget -O /dev/null -S "$line" 2>&1 | grep -q -m 1 "Expires: Sun, 19 Nov 1978 05:00:00 GMT"
if [ ${PIPESTATUS[1]} -eq 0 ]; then # check greps return code
echo "Yes"
echo "$line" >> yes_urls.txt
else
echo "No"
fi
done < text.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.