Code Sharing — Play a Random File on Linux

Some random geekery: I wrote this bash script a long time ago, but its served me well so I thought I’d post it on the vast Internet, in hope that maybe someone else may someday get use out of it. Google, don’t fail me now! Anyway, my linux bash script to randomly select a video file and play it follows below.

#!/bin/bash
count=`ls /path/to/your/videos |wc -l`
let "pick = $RANDOM % $count"
let "pick += 1"
kaffeine -p "/path/to/your/videos/`ls /path/to/your/videos|sed -n "$pick"p`"

There we go, sent out for posterity.

One Response to “Code Sharing — Play a Random File on Linux”


Funny that you wrote that so long ago and only now decided to post it for the world to use 🙂 All you have to do now is be able to “grade” your videos and be able to have it pick out of your top favorites (yes, like iTunes!) so we wouldn’t have to see some of our less-favorite later-season Simpsons over and over…

Teisha - March 21st, 2007 at 3:38 pm

Leave a Response (or trackback on your own site)

You must be logged in to post a comment.

Welcome

Welcome to Paradoxdruid's Rants... a community based webblog. Feel free to snag an account and post.

Contributors Login

Linkdump

My first first-author paper!

Just wanted to share that my first first-author paper is now online! In the journal Stem Cells and Development, here’s my paper on “Roles of Integrins in Human Induced Pluripotent Stem Cell Growth on Matrigel and Vitronectin.”


The Future of Scientific Publishing

Just read a fascinating (if lengthy) essay on disruptive technology and the future of scientific publishing. Well worth the read!


Deflation!

Just wanted to share Mint.com’s Visual Guide to Deflation, which is quite explanatory.


All Things Stem Cell

Hey all Paradoxdruid readers! I recently started up a blog on stem cells that I’d love you all to take a look at: http://www.allthingsstemcell.com/


Barely Literate: The Fermata

I participated in another Barely literate book review podcast, this time on Nicholson Baker’s “The Fermata”. Give it a listen!


Time for Change

Obama has outlined a strategy for America, in great depth. Read all about Change.gov!


Free Rice

Okay, I’ll admit that it’s entirely possible that I am the last person to learn about this website*, but it’s really addictive. 
(continued)


About

Site best viewed in Mozilla Firefox. Site CSS template by Andrea Pitschmann. Banner photo by photocase.