A blog about my experiences with bioinformatics, operating systems, and random other technologies and bits.

Saturday, June 30, 2007

The "simple" way to do things.

Who wants to make play lists or keep an alarm clock when you have your laptop with you 23/24 hours each day?

Say I want to find all the songs with bach or mozart in the title and loop through them. This (somewhat long) one-liner will do the trick:

echo `find ./ -name '*[B|b]ach*' -o -name '*[M|m]ozart*' | xargs -I song echo "'song'"` | xargs mplayer -loop 0

(substitute mplayer with your favorite command line music player) There is probably a shorter way of accomplishing the same thing. If you find such a way, please post it!


Setting an alarm is much simpler. If you want to get up in 8 hours,

bash-3.00$ bc
8*3600
28800
quit
bash-3.00$ sleep 28800 && mplayer Shared/George\ Michael\ wham\ -\ wake_me_up_before_you_go_go.mp4

If you have a more regular sleep schedule (but then, why would you be reading this?) you may find setting up a cron job to play a song more useful.

2 comments:

atar said...

under linux you can just say

sleep 8h &&

Unknown said...

Thanks, didn't know about the option for handling units in sleep.