fix false checks for return value

This commit is contained in:
2025-01-29 09:38:34 +01:00
parent 34f181815b
commit 9e83c1ecc1
2 changed files with 17 additions and 14 deletions

View File

@ -12,23 +12,22 @@ download() {
SUCCESS="false"
for ((n=0;n<5;n++)); do
gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"
if [[ $(echo $?) -eq 0 ]]; then
if gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"; then
echo "$1" >> "$SUCCESS_FILE"
SUCCESS="true"
break
fi
echo -e "${IYELLOW}download failed${NO_COLOR}"
if [[ $(ping -qc 3 v4.ip.hopeless-cloud.xyz > /dev/null 2>&1) -ne 0 ]]; then
if ! ping -qc 3 v4.ip.hopeless-cloud.xyz > /dev/null 2>&1; then
echo -e "${IYELLOW}no internet${NO_COLOR}"
exit 1
elif [[ $(ping -qc 3 v6.ip.hopeless-cloud.xyz > /dev/null 2>&1) -ne 0 ]]; then
elif ! ping -qc 3 v6.ip.hopeless-cloud.xyz > /dev/null 2>&1; then
echo -e "${IYELLOW}no internet${NO_COLOR}"
exit 1
else
echo -e "${IGREEN}has internet${NO_COLOR}"
fi
echo -e "${IGREEN}has internet${NO_COLOR}"
done
[[ $SUCCESS != \t\r\u\e ]] && echo "$1" >> "$FAIL_FILE"