#!/bin/sh ### This script will be executed by cron. This should be a ### very portable script. ### Usage: ./sigselect [Sleep] [Directory] ### where [Sleep] is time (in seconds) that the script will ### sleep between signature changes, and [Directory] is the ### directory that stores the signature files. ### The signature files in [Directory] should be named sequentially, ### with numerals and no leading zeroes (e.g. 1, 2, 3, 4, ...) ### DzM - 5/28/99 ### rev 0.1 5/28/99 Initial creation ### rev 0.2 6/23/99 Cleaning up ### rev 0.3 6/18/01 Made script more interactive ### Rather than require script to run through cron, ### it now takes command line options and sleeps ### rev 0.4 6/20/01 Added some error handling that prevents the ### script from running if no preferences are provided ### rev 0.4.1 7/30/01 Changed the calculation used to determine number ### of files sleep_time=$1 sig_dir=$2 loop="true" cd ${sig_dir} if [ ${sleep_time} -a ${sig_dir} ] then while [ $loop = "true" ] do files=`ls -1 | wc -l | awk '{print $1}'` file=`expr $RANDOM % $files` file=`expr $file + 1` cp $file $HOME/.signature sleep ${sleep_time} done else exit 1 fi