#!/usr/bin/perl -wNOTE: The $url line has been broken into two lines for display purposes; enter it on one line with no spaces.
$browser = "Mozilla";
print "Search string: ";
$keyword = <STDIN>;
chomp($keyword);
$url = "http://www.macosxhints.com/search.php?query=".$keyword."&
mode=search&datestart=0&dateend=0&topic=0&type=stories&author=0";
$todo = "\'Tell application \"$browser\" to OpenURL \"$url\"\'";
system("osascript -l AppleScript -e $todo");
You must modify the script if you use a different browser. "Explorer" instead of "Mozilla" and getURL instead of OpenURL. Read the other hint and the comments for more details on creating and saving this script. But this works like a charm for me in Mozilla.
[Editor's note: To extend the concept in these two hints to any searchable site, just visit the site in question and execute a search. Copy the URL from the results page and then use that in the "$url" line. Replacing your test search term in the URL with the reference to $keyword as shown in the two hints, and you have an instant command-line search tool for that particular website.]

