mirror of https://github.com/Chizi123/Reddit-wallpaper-fetcher.git

Joel Grunbaum
2021-08-27 8db5795f3cf446bda85822b4bc2ea527dc1db4b9
reddit-wallpaper-fetcher
@@ -41,6 +41,9 @@
for i in "${SUBREDDITS[@]}"; do
    temp=$(curl "$LOUD" --user-agent "$USER" "https://www.reddit.com/r/$i.json?sort=$SORT&limit=1")
    time=$(echo "$temp" | jq -r ".data.children[-1].data.created_utc")
    if [ "$time" == "null" ]; then
       continue
    fi
    if [ $(awk -v n1="$time" -v n2="$LATEST_TIME" 'BEGIN {printf (n1>n2?"1":"")}') ]; then
   LATEST="$temp"
   LATEST_TIME="$time"