#!/bin/csh -f # google # ------------------------------------------------------------------------- # C shell script to search Google for the specified strings # ------------------------------------------------------------------------- # Revision History: # $Log$ # ------------------------------------------------------------------------- # Collect command line options set image_url_string = "" while ($#argv > 0) if ("$1" == "-h" || "$1" == "--help") then echo "Usage: $0:t [options]" echo "Options:" echo " -h = Show this help text" echo " --help = Show this help text" echo " -i = Image. Show Image tab of Google results" echo " --image = Image. Show Image tab of Google results" exit 1 else if ("$1" == "-i" || "$1" == "--image") then shift set image_url_string = "&udm=2" else if ("-" == "`echo $1:q | cut -c 1`") then echo "Error: Invalid option: $1:q" $0 --help exit 1 else # Not a recognized option. Assume it's the first argument break endif end # Note: Use "o" instead of "open" to deal better with spaces. set browser = "o" # If $1 is a script in the browsers folder, use it as the browser. if ($#argv > 0 && -x "$0:h/browsers/$1") then set browser = $1:q shift endif if ($#argv == 0) then (set echo; $browser http://google.com) else (set echo; $browser "http://google.com/search?q=$1:q+$2:q+$3:q+$4:q+$5:q+$6:q+$7:q+$8:q+$9:q+$10:q+$11:q+$12:q+$13:q+$14:q+$15:q+$16:q+$17:q+$18:q+$19:q+$20:q$image_url_string") endif