#!/bin/sh [ -e "$1" ] || exit 1 if [ -d $1 ]; then bg=$(ls $1 | shuf -n 1) bg="$1/$bg" elif [ -f $1 ]; then bg=$1 else exit 1 fi echo $bg feh --bg-fill "$bg"