randomising tracks: scripting question

Devin Teske dteske at vicor.com
Sun Dec 26 20:08:43 UTC 2010


On Dec 26, 2010, at 11:02 AM, Frank Shute wrote:

> On Sun, Dec 26, 2010 at 06:01:45PM +0000, RW wrote:
>> 
>> On Sun, 26 Dec 2010 09:40:43 -0800
>> Chip Camden <sterling at camdensoftware.com> wrote:
>> 
>>> Quoth Frank Shute on Sunday, 26 December 2010:
>>>> I generally play my tracks of an album like so:
>>>> 
>>>> for track in $(cat trombone_shorty-backatown.m3u); do
>>>> mplayer $track
>>>> done
>>>> 
>>>> They then play in the correct order.
>>>> 
>>>> How would I go about randomising the order of play using
>>>> sh (preferably) or perl?
>>>> 
>>>> Sorry for the OT posting but I thought a brainteaser might clear the
>>>> fog caused by excessive Xmas indulgence ;)
>>>> 
>>>> 
>>>> Regards,
>>> 
>>> change "cat t...n.m3u" to "random < t..n.m3u"
>>> 
>> 
>> That should be 
>> 
>> random -f trombone_shorty-backatown.m3u
>> 
>> see random(6) for what happens when it reads directly from stdin
>> (without "-f -")
>> 
> 
> Excellent. I didn't know about random(6), I was getting lost in the
> manpages: there are manpages for random in 3 different sections!
> Should have used apropos.
> 

Just keep in mind that random(6) comes from the `games' distribution-set.

wget -r ftp://ftp-archive.freebsd.org/pub/FreeBSD/releases/i386/8.1-RELEASE/games
cd games
sudo ./install.sh

Not sure if it's available anywhere else.
--
Devin




More information about the freebsd-questions mailing list