[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash. Il file remoto esiste?



Andrea Ganduglia wrote:

>Ciao, avrei la necessita` di scrivere uno script di bash che faccia questo:
>
>if [ IL FILE http://www.qualchesito.com/file.ext ESISTE? ]; then
>
>wget file_remoto
>
>elif [ IL MIRROR DI QUESTO FILE ESISTE? ]; then
>
>wget file_mirror
>
>fi
>
Non ne hai bisogno: se il file non c'è wget non lo scarica.
Eventualmente, se proprio hai bisogno di un controllo, puoi controllare
l'exit code di wget:

wget file_remoto
if [ $? -gt 0 ];  then
    echo "wget ha dato errore"
fi



Reply to: