#!/bin/sh
if [ "$*" != "" ]
then
    a="$*"
else
    a="`xcb -p 0 | sed -e 's/^ *//' -e 's/  *$//'`"
fi

# Try to do useful things with different strings
case "$a" in
    [0-9][0-9]*)
        # Assume a Bugster bug id.
        url="http://monaco.sfbay.sun.com/detail.jsf?cr=$a"
        ;;
    *ARC/[0-9][0-9]*/[0-9][0-9]*)
        # Assume an ARC case
        url="http://sac.eng.sun.com/Archives/CaseLog/arc/$a"
        ;;
    http*)
        # If the string starts with "http", assume that it is a URL
        # and use as is.
        url="$a"
        ;;
    *)
        # Otherwise, search in Google.
        url="http://www.google.co.uk/search?hl=en&q=${a}&meta="
        ;;
esac

exec x-www-browser "$url"

Generated by David Edmondson using trampaste at Tue Jan 15 13:54:57 2013. GMT. (original)