[net.sources] Your Light's Are On

perlman@wanginst.UUCP (Gary Perlman) (12/06/85)

It's that time of year, and people in the parking lot have left their
lights on.  In a few days, the following shell script has helped us find
several people.  You have to do some editing (change the "DATABASE" file
name and create it to be publicly writable), and the only documentation
is in help messages, but it's pretty easy.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	auto
# This archive created: Fri Dec  6 13:15:08 1985
# By:	Gary Perlman (Wang Institute, Tyngsboro, MA 01879 USA)
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'auto'
then
	echo shar: "will not over-write existing file 'auto'"
else
cat << \SHAR_EOF > 'auto'
#! /bin/sh

# auto finder program, useful for dopes like me who leave their lights on

# Note to auto program installer, to simplify finding cars and printing
# of lists for people like receptionists/guards, you should periodically
# edit the list to standardize the format.  I suggest the following
# ordering of fields with tabs in between:
#       Driver   TAB   Year Color Maker Model   TAB   State Plate
# Specific sites may want to add phone extensions etc. somewhere.

# The script is designed to allow (1) people to decide if they want
# their information in a public place, and (2) simple input formats.
# The simplicity of the imput format (free text) makes it necessary
# for a good Samaritan to fix things up occasionally.

DATABASE=/usr/ebin/.auto  # must be created and publicly writeable: chmod 666
PGM=auto

command=$1

case "$command" in
add)
	shift
	echo $* >> $DATABASE ;;
find)
	grep -i "$2" $DATABASE ;;
help)
	echo "$PGM: store and find information about local automobiles
	$PGM add information
		(eg: auto add Gary Perlman 1927 Nash PQ 1J1927)
		NOTE: avoid spaces and hyphens in plate numbers
	$PGM find pattern
		(eg: auto find 1j1927)
		NOTE: upper/lower case differences ignored
	$PGM list
		print a list sorted by license plate" ;;
list)
	expand -20,60 $DATABASE | sort -i +0.60 ;;
*)
	echo "Usage:
	$PGM add information
	$PGM find pattern
	$PGM help
	$PGM list"
esac

exit 0
SHAR_EOF
chmod +x 'auto'
fi
exit 0
#	End of shell archive
-- 
Gary Perlman  Wang Institute  Tyngsboro, MA 01879  (617) 649-9731
UUCP: decvax!wanginst!perlman             CSNET: perlman@wanginst