playing mp3s in orer

May 4th, 2011 § 0 comments § permalink

I often use mplayer to play all files in a directory:

mp ./*

*mp*, by the way, is simply an alias for mplayer, used to play things faster and with speed control:


$ which mp
mp: aliased to mplayer -speed 1.21 -af scaletempo=speed=tempo

But what if I want to play them in date order? (useful to replay a stream with streamripper). I need a shell loop. A for loop will choke on filenames with spaces
:


$ for i in `ls -tr`
do
mp "$i"
done

A while loop seems to give me some problem of mplayer reading too much from stdin:


$ ls -1tr | while read i
do; mp '$i'
done

So I end up using an array:


$ mp3files=( ./*mp3 )
$ for d in "${mp3files[@]}"; do
mp "$d"
done

phew! that was far too much work

open matching in vim

April 18th, 2011 § 0 comments § permalink

To open in vim all files matching a regex:

$ grep -l foo ./* | xargs vim -p

Where Am I?

You are currently browsing the bash category at Dan O'Huiginn.