Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'the shell version' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
the shell version
Authored by: mervTormel on Aug 01, '02 08:09:49PM

here's a shell version that uses the fink tool 'openurl' ; that will open an url in the default browser. this avoids the overhead of perl and applescript.

% cat shmox

#!/bin/sh

# file: shmox - search hints at macosxhints.com

# what's the site?
qSite="www.macosxhints.com"

# what's the query setup?
url1="http://${qSite}/search.php?query="

# keyword on the command line? deal with spaces in the query
keyword="$@"

# what's the query completion?
url2="&mode=search&datestart=0&dateend=0&topic=0&type=stories&author=0"

# no keyword on the command line? gotta have something to search for
[ "${keyword}" ] || { echo -n "search ${qSite}: "; read keyword; }

# construct the url
url=${url1}"${keyword}"${url2}

# want to see the crafted query? uncomment this tripe
# /bin/echo "submit ${qSite} query: "; echo ${url} | /usr/bin/fold

# splat
/sw/bin/openurl "${url}"



[ Reply to This | # ]