I’m working on a script randomly grab mp3s from a playlist and fill a CD with shuffled songs.

I’ll be using bash’s built-in random number generator which I believe is available in all versions.

Here’s the shuffle function for those interested:


# Usage: shuffle <filename>
function shuffle () {

   cat "${@}"|grep -v "^#" | 
   while read mp3 ; do
      echo "$RANDOM $mp3"
   done | sort | cut -d" " -f2-
}

Requirements will be mpg321 and cdrecord.