From owner-freebsd-questions@FreeBSD.ORG Sun Dec 26 19:02:20 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CCFE106564A for ; Sun, 26 Dec 2010 19:02:20 +0000 (UTC) (envelope-from frank@esperance-linux.co.uk) Received: from asmtp1.iomartmail.com (asmtp1.iomartmail.com [62.128.201.248]) by mx1.freebsd.org (Postfix) with ESMTP id 12D2C8FC08 for ; Sun, 26 Dec 2010 19:02:19 +0000 (UTC) Received: from asmtp1.iomartmail.com (localhost.localdomain [127.0.0.1]) by asmtp1.iomartmail.com (8.13.8/8.13.8) with ESMTP id oBQJ2I1p003521; Sun, 26 Dec 2010 19:02:18 GMT Received: from orange.esperance-linux.co.uk (80-45-152-196.static.dsl.as9105.com [80.45.152.196]) (authenticated bits=0) by asmtp1.iomartmail.com (8.13.8/8.13.8) with ESMTP id oBQJ2H5D003510; Sun, 26 Dec 2010 19:02:18 GMT Received: by orange.esperance-linux.co.uk (Postfix, from userid 1001) id 59FE633C1F; Sun, 26 Dec 2010 19:02:17 +0000 (GMT) Date: Sun, 26 Dec 2010 19:02:17 +0000 From: Frank Shute To: RW Message-ID: <20101226190217.GA69973@orange.esperance-linux.co.uk> References: <20101226170930.GA68817@orange.esperance-linux.co.uk> <20101226174043.GB10951@libertas.local.camdensoftware.com> <20101226180145.7eae6855@gumby.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101226180145.7eae6855@gumby.homeunix.com> User-Agent: Mutt/1.4.2.3i X-Face: *}~{PHnDTzvXPe'wl_-f%!@+r5; VLhb':*DsX%wEOPg\fDrXWQJf|2\,92"DdS%63t*BHDyQ|OWo@Gfjcd72eaN!4%NE{0]p)ihQ1MyFNtWL X-Operating-System: FreeBSD 8.2-PRERELEASE amd64 X-Organisation: 'shute.org.uk' Cc: freebsd-questions@freebsd.org Subject: Re: randomising tracks: scripting question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Frank Shute List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Dec 2010 19:02:20 -0000 On Sun, Dec 26, 2010 at 06:01:45PM +0000, RW wrote: > > On Sun, 26 Dec 2010 09:40:43 -0800 > Chip Camden 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. Regards, -- Frank Contact info: http://www.shute.org.uk/misc/contact.html