#!/usr/bin/env bash # Start in the script's pwd # (ideally something like /usr/share/wallpapers/thurstylark/) wallp_dir=$(dirname "$0") # Get one subdir from $wallp_dir wallp_subdir=$(find "$wallp_dir" -type d | shuf -n 1) # Get one file from $wallp_subdir find $wallp_subdir -type f \( -iname \*.jpg -o -iname \*.png \) | shuf -n 1