Created
June 3, 2024 11:56
-
-
Save franciscojsc/6ed5fa2ee127e9812715876f90fe3061 to your computer and use it in GitHub Desktop.
Este script é uma maneira eficiente de automatizar o download de múltiplos arquivos a partir de uma lista de URLs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Verifica se o arquivo de URLs foi fornecido | |
if [ -z "$1" ]; then | |
echo "Uso: $0 <arquivo_de_urls>" | |
exit 1 | |
fi | |
# Verifica se o arquivo existe | |
if [ ! -f "$1" ]; then | |
echo "Arquivo $1 não encontrado!" | |
exit 1 | |
fi | |
# Lê o arquivo de URLs linha por linha | |
while IFS= read -r url; do | |
# Usa wget para baixar cada URL | |
wget "$url" | |
done < "$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://example.com/file1 | |
http://example.com/file2 | |
http://example.com/file3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment