<br><br><div class="gmail_quote">On Nov 14, 2007 1:19 PM, gibble <<a href="mailto:gibble@gmail.com">gibble@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>This should work.<br><br>#!/bin/bash<br><br># File locations<br>BgPath=/usr/share/mythtv/themes/glass-wide/backgrounds<br>BgFile=/usr/share/mythtv/themes/glass-wide/background.png<br>TempLog=/tmp/random.log<br><br># Create a temporary logfile of all matches
<br>find $BgPath -iregex ".*.png" > $TempLog<br><br># Choose a random line number (any number from 1 to the length of the file)<br>LowerBound=1<br>RandomMax=32767<br>UpperBound=$(cat $TempLog | wc -l)<br>RandomLine=$(( $LowerBound + ($UpperBound * $RANDOM) / ($RandomMax + 1) ))
<br><br># Use sed to grab the random line<br>Command=$(sed -n "$RandomLine{p;q;}" "$TempLog")<br><br># Link the file<br>ln -s $Command $BgFile<br><br># Restart X<br>pkill xinit<br><br></blockquote></div>
<br>Sweet. Now will mythfrontend have to be restarted after the background file is linked?<br><br>TK<br>