#!/bin/sh -x # FILE: setbg-bsd # AUTHOR: Greg Schenzel # DESCR: This is the Bourne Shell version of my "setbg" script. # It requires the following: # random(6) of bsdgames, hence the name # xdpyinfo(1) of X11R6 # qiv(1), image viewer # sh/awk/ls/grep/wc, standard unix tools # NOTE: Instead of depending on the ksh(1) and bc(1) programs, this # depends on the random(6) bsd game. Therefor, it is more likely to # work BSD operating systems and systems without a ksh implementation. # If you run Linux and don't have either bsdgames or ksh installed, # then you need one or the other. Debian users can apt-get the # bsdgames package. IMGS='*.jpg *.png *.gif *.bmp' cd ~/backgrounds/`xdpyinfo | grep dimensions | awk '{print $2}'` COUNT=`/bin/ls ${IMGS} | wc -l` random -e ${COUNT} SEL=$? IMG=`/bin/ls ${IMGS} | awk '{line[NR-1] = $0} END {print line['${SEL}']}'` qiv --bg_color "#7a8f9e" --root "$IMG"