#!/bin/csh -f # remind # ----------------------------------------------------------------------------- # Shell script to look up lines in my calendar # ----------------------------------------------------------------------------- # Usage: See Usage section below or run with no arguments to see usage. # Assumptions: # Effects: # - Reports info to stdout # Notes: # Implementation Notes: # Portability Issues: # Revision History: # $Log$ # ------------------------------------------------------------------------------ # grep options: # -i = ignore case if ($#argv == 0 || "$1" == "-h" || "$1" == "--help") then echo "Usage: $0:t string_to_search_in_calendar" exit 1 endif # Search silently to see if any matches # :q = Quote the parameter in case it contains multiple space-separated words. grep -i $1:q ~/fred/admin/remind.lis > /dev/null set rc = $status if ($rc == 0) then # Matches found. Pipe through less with highlighting of matches. # +/$1:q = Search for specified string # -I = Ignore case # -+F = Don't exit less even if output fits on screen. This is # because less may have jumped ahead to the first match and # not counted the earlier text of a long paragraph as needing # to fit on the screen. grep -i $1:q ~/fred/admin/remind.lis | less -I -+F +/$1:q endif