#!/usr/pkg/bin/bash

#How many files can we choose from?  (All gifs in the directory, less sotd.gif)
#n=`\ls *gif | grep -v sotd.gif | wc | awk '{print $1}'`
n=`\ls *gif *jpg | grep -v sotd.gif | wc -w`

#Let's pick one, then.
x=$(($RANDOM % $n + 1))

#Figure out its filename.
f=`\ls *gif *jpg | grep -v sotd.gif | head -$x | tail -1`

#Print out the name of the new target.
echo Changing sotd image to $f.

#Remove the old link.
\rm -f sotd.gif

#Create a new one.
ln -s $f sotd.gif
