#!/bin/bash ########################################################################### ## Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3 ## ## Please see: http://www.gnu.org/licenses/gpl.html for legal details, ## ## rights of fair usage, the disclaimer and warranty conditions. ## ########################################################################### # Check that we have at least one argument. if [ $# -eq 0 ]; then echo "Usage: `basename $0` " exit 1 fi # Read in the city from command line. for arg in "$@"; do QUERY_CITY=$QUERY_CITY"+"$arg CITY=$CITY" "$arg done # Fetch from Google. RESULT=`curl --user-agent "" "http://www.google.co.uk/search?q=time+now+in$QUERY_CITY" -s | egrep -o "[0-9]+:[0-9]{2,}<\/b>"` # Clean the bold anchors. RESULT=`echo $RESULT | sed 's///g' | sed 's/<\/b>//g'` # Make growl display the result. osascript< 0 end tell if isRunning then tell application "GrowlHelperApp" -- The following line was used when creating a standalone script. -- set the googletime to do shell script "curl --user-agent \"\" \"http://www.google.co.uk/search?q=time+now+in+new+jersey\" -s | egrep -o \"[0-9]+:[0-9]{2,}\"" set the allNotificationsList to {"GoogleTime"} set the enabledNotificationsList to {"GoogleTime"} register as application "GoogleTime" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "GrowlHelperApp" -- Send the notification... notify with name "GoogleTime" title $(echo "\""$CITY"\"") description $(echo "\""$RESULT"\"") application name "GoogleTime" end tell end if END