fbsetbg Wallpaper Rotation

Bash wallpaper rotation is a simple wallpaper changer for GNU/Linux. It doesn’t work in every environment, but one’s which use fbsetbg to set the wallpaper. The usage of the script is fairly basic, you can set the delay timer in which wallpapers are changed, as well as demonizing the script or not.

#/bin/bash

if [ -z "$1" ]
then
        echo "usage: $0 (sleep timer) (d|-d|--daemon)"
        exit 1
fi

daemon="no"

for i in "$@"
do
        if [ "$i" == "d" ] || [ "$i" == "-d" ] || [ "$i" == "--daemon" ]
        then
                daemon="yes"
        else
                time=$i
        fi
done

if [ "$daemon" == "yes" ]
then
        $0 $time &> /dev/null &
        exit 0
fi

while [ 1 == 1 ]
do
        for i in `ls | grep -v ${0:2:${#0}}`
        do
                fbsetbg $i
                sleep $time
        done
done

Feedback