From b8a536e625ee89d444dd491fd2b275f6ce7a142c Mon Sep 17 00:00:00 2001 From: Marcos Marado Date: Wed, 12 Apr 2023 21:25:58 +0100 Subject: [PATCH] covid: fix script's error validation This is not fixing the fact that the script fails when running on an GA, but it will fall in the correct error case - hopefully. --- scripts/52-covid.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/52-covid.sh b/scripts/52-covid.sh index f17ae81..1c0a47c 100755 --- a/scripts/52-covid.sh +++ b/scripts/52-covid.sh @@ -1,9 +1,9 @@ #!/bin/bash -urls=$(for item in $(wget https://covid19.min-saude.pt/numero-de-novos-casos-e-obitos-por-dia/ -o /dev/null -O - | hxnormalize -x -l 1000| hxselect .wp-block-spms-accordion-item|hxselect a -s'\n'); do echo "$item"|grep href; done|cut -d\" -f2|grep -v ^$|grep -v http://Novos); +urls=$(for item in $(wget https://covid19.min-saude.pt/numero-de-novos-casos-e-obitos-por-dia/ -o /dev/null -O - | hxnormalize -x -l 1000| hxselect .wp-block-spms-accordion-item|hxselect a -s'\n'); do echo "$item"|grep href; done|cut -d\" -f2|grep -v http://Novos); -nurls=$(echo "$urls"|wc -l); -nnxls=$(echo "$urls"|grep -c -v xlsx); +nurls=$(echo "$urls"|grep -v ^$|wc -l); +nnxls=$(echo "$urls"|grep -v ^$|grep -c -v xlsx); if [ "$nurls" -eq "0" ]; then echo "covid: não foram encontrados urls, script não deve estar a funcionar correctamente.";