#!/bin/csh -f # tips # ----------------------------------------------------------------------------- # C shell script to show Fred's Tips web site # ----------------------------------------------------------------------------- # Revision History: # $Log$ # ----------------------------------------------------------------------------- set browser = "open" # 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://bristle.com) else # Note: This code is duplicated in links script. Update there also. # Fix common typos if ("$1" == "interent") set argv[1] = "internet" # Strip off unneeded ".htm" that is so often added by using tab for # filename completion # Note: The =~ operator compares left arg with right glob pattern if ("$1" =~ "*.htm") set argv[1] = "$1:r" echo "Searching for Tips page: $1:q.htm..." set found = "false" foreach name (`cd ~/fred/website/bristle/Tips; ls -d *.htm`) set lowercase_name = `echo "$name:q" | lowercase` if ("$lowercase_name" == "$1.htm") then set found = "true" (set echo; $browser http://bristle.com/Tips/$name) endif end if ("$found" == "false") then echo "Searching for text on main page: $1:q..." (set echo; $browser "http://bristle.com/#:~:text=$1") endif endif