#!/usr/bin/env bash # Download wallpapers via the wallhaven API # Reads search term, start page and end page read -p "Enter search term: " search_term read -p "Enter start page: " start_page read -p "Enter end page: " end_page current_page=$start_page while [ $current_page -le $end_page ]; do curl -s "https://wallhaven.cc/api/v1/search?q=$search_term&page=$current_page" | jq '.data[].path' | xargs -I{} curl -O {}; current_page=$(( current_page+1 )); done