fix false checks for return value
This commit is contained in:
@ -13,8 +13,6 @@ else
|
|||||||
output=$([[ $(hostname) = \s\a\t\a\n ]] && cargo run -- add_custom_name "$1" "$2" || ./Hentai add_custom_name "$1" "$2")
|
output=$([[ $(hostname) = \s\a\t\a\n ]] && cargo run -- add_custom_name "$1" "$2" || ./Hentai add_custom_name "$1" "$2")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# output="https://rule34.xxx/index.php?page=post&s=list&tags=donnard # Artists/donnard/Rule34"
|
|
||||||
|
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[[ $output =~ "#" ]] || exit 1
|
[[ $output =~ "#" ]] || exit 1
|
||||||
|
|
||||||
@ -29,14 +27,20 @@ fi
|
|||||||
echo "command: gallery-dl --config ./gallery-dl/config.json --directory $path $url"
|
echo "command: gallery-dl --config ./gallery-dl/config.json --directory $path $url"
|
||||||
|
|
||||||
for ((n=0;n<5;n++)); do
|
for ((n=0;n<5;n++)); do
|
||||||
gallery-dl --config ./gallery-dl/config.json --directory "$path" "$url"
|
if ! gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"; then
|
||||||
|
echo -e "${IGREEN}Success${NO_COLOR}"
|
||||||
[[ $(echo $?) -eq 0 ]] && echo -e "${IGREEN}Success${NO_COLOR}" && exit 0
|
exit 0
|
||||||
|
fi
|
||||||
echo -e "${IYELLOW}download failed${NO_COLOR}"
|
echo -e "${IYELLOW}download failed${NO_COLOR}"
|
||||||
|
|
||||||
[[ $(ping -c 3 v4.ip.hopeless-cloud.xyz > /dev/null 2>&1) -ne 0 ]] && echo -e "${IRED}no internet${NO_COLOR}" && exit 1
|
if ! ping -c 3 v4.ip.hopeless-cloud.xyz > /dev/null 2>&1; then
|
||||||
[[ $(ping -c 3 v6.ip.hopeless-cloud.xyz > /dev/null 2>&1) -ne 0 ]] && echo -e "${IRED}no internet${NO_COLOR}" && exit 1
|
echo -e "${IRED}no internet${NO_COLOR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! ping -c 3 v6.ip.hopeless-cloud.xyz > /dev/null 2>&1; then
|
||||||
|
echo -e "${IRED}no internet${NO_COLOR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "${IGREEN}has internet${NO_COLOR}"
|
echo -e "${IGREEN}has internet${NO_COLOR}"
|
||||||
done
|
done
|
||||||
|
@ -12,23 +12,22 @@ download() {
|
|||||||
SUCCESS="false"
|
SUCCESS="false"
|
||||||
|
|
||||||
for ((n=0;n<5;n++)); do
|
for ((n=0;n<5;n++)); do
|
||||||
gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"
|
if gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"; then
|
||||||
|
|
||||||
if [[ $(echo $?) -eq 0 ]]; then
|
|
||||||
echo "$1" >> "$SUCCESS_FILE"
|
echo "$1" >> "$SUCCESS_FILE"
|
||||||
SUCCESS="true"
|
SUCCESS="true"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
echo -e "${IYELLOW}download failed${NO_COLOR}"
|
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}"
|
echo -e "${IYELLOW}no internet${NO_COLOR}"
|
||||||
exit 1
|
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}"
|
echo -e "${IYELLOW}no internet${NO_COLOR}"
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
echo -e "${IGREEN}has internet${NO_COLOR}"
|
||||||
fi
|
fi
|
||||||
echo -e "${IGREEN}has internet${NO_COLOR}"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ $SUCCESS != \t\r\u\e ]] && echo "$1" >> "$FAIL_FILE"
|
[[ $SUCCESS != \t\r\u\e ]] && echo "$1" >> "$FAIL_FILE"
|
||||||
|
Reference in New Issue
Block a user