#!/usr/bin/bash [[ -f downloaded_r34.txt ]] || echo "no file to download from" || exit 1 cp downloaded_r34.txt to_download_r34.txt while [ 1 ] do gallery-dl --config ./config.json --input-file-delete to_download_r34.txt if [ ! -s to_download_r34.txt ]; then #success! just exit echo "file empty" rm to_download_r34.txt exit 0 fi echo "file not empty" if [ $(ping -qc 3 rule34.xxx > /dev/null 2>&1) ]; then echo "no internet" exit 1 fi echo "has internet" done