#!/bin/csh -f # links # ----------------------------------------------------------------------------- # C shell script to show the specified row of Fred's links page, or the # specified subpage of the links page # ----------------------------------------------------------------------------- # 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/~fred) else # Note: This code is duplicated in tips 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 Links page: $1:q.htm..." set found = "false" foreach name (`cd ~/fred/website/bristle/Links; 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/Links/$name) endif end if ("$found" == "false") then echo "Searching for row on main Links page: $1:q..." (set echo; $browser "http://bristle.com/~fred#$1") endif endif