Skip to content

Instantly share code, notes, and snippets.

@Khahory
Created August 1, 2023 16:16
Show Gist options
  • Save Khahory/f597f9a65d925ba865a3412ede169f73 to your computer and use it in GitHub Desktop.
Save Khahory/f597f9a65d925ba865a3412ede169f73 to your computer and use it in GitHub Desktop.
Buee, no funciona
#!/bin/bash
num_inicio=$1
num_fin=$2
# for
for i in $(seq $num_inicio $num_fin); do
# validar si una ulr nos devuelve un 200
url="https://idiomas.unapec.edu.do/media/$i/calendario-academico-2023-1.pdf"
response=$(curl -s -o /dev/null -w "%{http_code}" $url)
if [ $response -eq 200 ]; then
echo "La url $url esta activa"
mkdir -p ./descargas-linux
# descargar el archivo
curl -o ./descargas-linux/calendario-academico-2023-1-$i.pdf $url
else
echo "La url $url no esta activa"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment