This bash script will come in handy with my idea of using habak in a
cron job to update the background to my screen every hour:
------------
#!/bin/bash
DIR=~/wallpaper
nfiles=$(ls -1 $DIR | wc -l | tr -d ' ')
fileno=$(( ($RANDOM % $nfiles) + 1 ))
FILE=$DIR/$(ls -1 $DIR | head -n $fileno | tail -n 1)
echo $FILE
------------
Thanks to Joshua Oreman
(http://lists.freebsd.org/pipermail/freebsd-questions/2003-August/016689.html)
for the script. Also, another possible script is randfile found at
http://www.shelldorado.com/scripts/quickies/randfile
Thursday, December 30, 2004
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment