while [ 1 ]; do num=`ls ~/Backgrounds/* | wc -l` rand=`jot -r 1 1 $num` i=0 for f in ~/Backgrounds/*; do if [ $i = $rand ]; then gconftool-2 -s -t string /desktop/gnome/background/picture_filename $f fi i=$(( $i+1 )) done sleep 900 done