random-image-picker/shuffle.sh
2026-04-12 22:45:40 +05:00

13 lines
370 B
Bash
Executable file

#!/bin/bash
SOURCE_DIR="$(dirname -- "${BASH_SOURCE[0]}")"
EXTRACTION_DIR="$SOURCE_DIR/selection/"
SFW_DIR="$SOURCE_DIR/alternative/"
EXTRACTED_FILE="$(find -L $SOURCE_DIR/selection/ -type f | shuf -n 1)"
magick $EXTRACTED_FILE $SOURCE_DIR/selected.jpg
if [ "$OVERRIDE_SFW" = "1" ]; then
magick "$(find -L $SFW_DIR -type f | shuf -n 1)" $SOURCE_DIR/selected.jpg
fi