Something went wrong. Try again.
my dotfiles for arch
Something went wrong. Try again.
123456789101112131415161718192021222324#!/bin/bash
# Predefined folder pathFOLDER="$HOME/wallpapers"
# Check if folder existsif [[ ! -d "$FOLDER" ]]; then echo "Error: Folder '$FOLDER' does not exist." >&2 exit 1fi
# Find all image files recursivelyimages=($(find "$FOLDER" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.bmp" -o -iname "*.webp" \) 2>/dev/null))
# Check if any images were foundif [[ ${#images[@]} -eq 0 ]]; then echo "No image files found in '$FOLDER' or its subdirectories" >&2 exit 1fi
# Select and output random image pathrandom_index=$((RANDOM % ${#images[@]}))echo "${images[$random_index]}"