Enviado em 24/07/2021 - 18:23hPara simular um problema alterei o nome do arquivo PACKAGE.txt na linha do curl abaixo.
Enviado em 25/07/2021 - 20:30hDa manpage do curl.
(HTTP) Fail silently (no output at all) on server errors. This
is mostly done to better enable scripts etc to better deal with
failed attempts. In normal cases when an HTTP server fails to
deliver a document, it returns an HTML document stating so
(which often also describes why and more). This flag will pre‐
vent curl from outputting that and return error 22.
This method is not fail-safe and there are occasions where non-
successful response codes will slip through, especially when
authentication is involved (response codes 401 and 407).
Fail and exit on the first detected transfer error.
When curl is used to do multiple transfers on the command line,
it will attempt to operate on each given URL, one by one. By
default, it will ignore errors if there are more URLs given and
the last URL's success will determine the error code curl
returns. So early failures will be "hidden" by subsequent suc‐
Using this option, curl will instead return an error on the
first transfer that fails, independent of the amount of URLs
that are given on the command line. This way, no transfer fail‐
ures go undetected by scripts and similar.
This option is global and does not need to be specified for each
use of -:, --next.
This option does not imply -f, --fail, which causes transfers to
fail due to the server's HTTP status code. You can combine the
two options, however note -f, --fail is not global and is there‐
fore contained by -:, --next.
Added in 7.52.0.
Enviado em 25/07/2021 - 23:30h
rm -Rf /tmp/$FILE
curl -f $URL/$FILE -o /tmp/$FILE 2>&-
if [ "$?" == "0" ]; then
echo "Arquivo $FILE baixado para /tmp"
ls -lh /tmp/$FILE
echo "Erro ao baixar o arquivo PACKAGE.txt do site $URL"
Conhecimento não se Leva para o Túmulo.