Select random picture
Thursday, November 24th, 2005The following command selects a random picture from the directory for the current year, copies it to the file random.jpg and stores the path in file.txt.
#!/bin/sh cd $HOME/public_html/images year=`date +\"%Y\"` file=`/usr/X11R6/bin/xscreensaver-getimage-file --name $year` cp $file random.jpg echo $file > file.txt
It can be used to generate a random background image by e.g. running it as a hourly cron job.