Get Examples for Random Bash Commands

Following my post about a script to query bash commands from shell-fu, here is another script, which queries shell-fu for examples of a random bash command:

The script is not bullet-proof and might fail if the guys at shell-fu decide to change the website’s layout, but it works for now, and this is good

Open a new text file and type this:

1
2
3
4
#!/bin/bash
PAGER="/usr/bin/less -rXF"
lynx -width=$COLUMS -nonumbers -dump "http://www.shell-fu.org/lister.php?random" |\
sed -n '/Tailrank/,/View Comments/p' shrnd.tmp | sed '$d' | sed '1,2d' | $PAGER

Now save the file as shexrand, or any other name (shexrand is for shell example – random)

Make the file executable:

chmod +x shexrand

Now move the file to /usr/local/bin

Thats it, to use it, just type:

shexrand

and you should get an example of a random bash command.

Enjoy

If you enjoyed this post, make sure you subscribe to my RSS feed!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

No related posts.

Tags: , , ,

Saturday, February 28th, 2009 Bash

Leave a Reply

my email
my photo
Hi,
My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and a BSc. in electrical engineering from The Electrical Engineering school , Technion , Israel.
I'm a Verification Engineer in Mellanox Technologies Ltd.
I love Linux, the Command Line and the OpenSource Community.
I used to write Poems (Arabic) when I was able to find time for this.
February 2009
S M T W T F S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728
SEO Powered by Platinum SEO from Techblissonline

Twitter links powered by Tweet This v1.7.4, a WordPress plugin for Twitter.