Ordos :: blog


Bash: download file and check result

Upload the file and perform some actions if the upload went well (status 200).

#!/bin/bash  
  
wget_result="$(wget -S -O /tmp/file.txt https://megafilestorageexample.com/file/lkh2InohhH5EW3DdI2 2>&1 | grep "HTTP/" | awk '{print $2}')"  
  
if [[ $wget_result == 200 ]]; then  
   echo "ok"  
fi

Размещено от


Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *