Listen to BBC Radio from the command line.

bbcradio() { local s PS3="Select a station: ";select s in 1 1x 2 3 4 5 6 7 "Asian Network an" "Nations & Local lcl";do break;done;s=($s);mplayer -playlist ""${s[@]: -1}".asx";}
This command lets you select from 10 different BBC stations. When one is chosen, it streams it with mplayer. Requires: mplayer with wma support.

2009-11-14 08:17:03

What Others Think

Nice bash function! Thanks for share it.
danpos · 619 weeks ago
As far as I'm aware, the only other shell that supports the select statement is ksh. Tcsh, csh, ash, dash, sash, fish, and sh do not.
eightmillion · 618 weeks and 6 days ago
Does anyone know how I can make this an alias command? I tried alias radio=`...command...` but it doesn't work.
diggmc · 618 weeks and 6 days ago
@axelabs: zsh also supports select. @diggmc: Quoting can be a challenge, try: alias zzz='echo "Select a station:";select s in 1 1x 2 3 4 5 6 7 "Asian Network an" "Nations & Local lcl";do break;done;echo mplayer -playlist ""$(echo "$s"|awk '\''{print $NF}'\'')".asx"' @eightmillion: You don't need awk, you can do: bbcradio() { local s;echo "Select a station:";select s in 1 1x 2 3 4 5 6 7 "Asian Network an" "Nations & Local lcl";do break;done; s=($s); s=${s[@]: -1}; $mplayer -playlist ""$s".asx";}
dennisw · 618 weeks and 6 days ago
I meant to edit that "zzz" and change it to "radio". Oops.
dennisw · 618 weeks and 6 days ago
Thanks Dennis. Using an array there is a great idea.
eightmillion · 618 weeks and 6 days ago
I don't know why but it does not work for me... I'm using the gnome terminal and I've installed mplayer. I seems so nice to listen to the radio from the terminal... snif
Lepirate · 618 weeks and 6 days ago
a full listing of BBC radio channels is available here : -- thadiyan
thadiyan · 618 weeks and 4 days ago
very good, I got a radio, thanks
twfcc · 618 weeks and 3 days ago
This doesn't work for me. Do you just paste it as is? I get the prompt after pressing enter.
Buzzcp · 616 weeks and 6 days ago
Buzzcp, it's a function, so you have to call it after you define it (which is what this submission does). After you enter it in, you just have to enter "bbcradio" in your shell to listen. If you want to always have the command available, you'll need to add the function to your .bashrc file in your home directory.
eightmillion · 616 weeks and 6 days ago
@dennisw: Quoting can be a challenge, try: alias zzz='echo "Select a station:";select s in 1 1x 2 3 4 5 6 7 "Asian Network an" "Nations & Local lcl";do break;done;echo mplayer -playlist " Sorry for the late response. Thank You.
diggmc · 615 weeks and 6 days ago
scream, or enjoy the cicadas flap its wings when you bring the cool wind; when passing Hasuike also puffed breath goods products that Lotus aroma; hours because ignorance has been poked hornet's nest and stung his face was bruised. Dig once, because "small insects" (Sparrow) and took out a "snake" (Snake) scared to fall from the wall. Fortunately, nothing serious. Leisure time, will collect some cigarette paper folded triangle, and partners to play; (the triangle on the ground and put his hand on the ground quick photo shoot the other side of the triangle is the triangle that turned their a); and also than own older brother and sister were led to a wide flat on the grass or doing "of chicken" or "kill the lamb" of the game, before the election when one eagle, then tall in front when hens , when the rest of the chicken, the eagle chasing shot at the back of the chick, hen with open arms to protect chickens, smart dodge to keep eagle patting. Or a dozen people sitting in a circle, do a do Diushou Juan game: the hands of only one person to take the handkerchief out of his mouth in a circle singing Diushou Juan songs, danced around the circle turning quietly throw the handkerchief in the back of a person. Then run around in circles. If you have a lap behind the handkerchief patting, this people have not found the person you want to give a performance for everyone; a joke, sing songs, or back poem. Then began Diushou Juan by him or her. If this is discovered immediately took the handkerchief catch Diushou Juan people, that Diushou Juan will continue to lose, someone who can back into place; catch, and throw this man who has sat on the bit when this man will be punished performances. We will play along with a dozen "Stars over the month child" or "cat drilled 72 holes" game. (Read the article Network: I remember one summer, that the acquisition of medicinal city recovered cicada skin (medical term called cicada), catty two five. So every day, together with my brothers holding bamboo, Dianzhe plastic bags, and from the village in the woods to find a tree cicada skin, after the end of the summer, we harvest relatively big, full harvest four pounds, to buy ten dollars. The next summer we look for a summer, more than the first year looking for even more, I did not expect there to happily after being told not recovered. Cicada got hard skin, back at home after shuffling, and
zyf543 · 285 weeks ago
Hello everybody, I'm not very good with unix but this command line is interesting and I don't understand how to use this command line :/ someone can give me an example plz ?
GabGab · 271 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: