[alt.sources.d] areacode.

david@infopro.UUCP (David Fiedler) (08/14/90)

On my system, this is leaving temp files all over the place. A real kludge
fix is the line:

(sleep 5 ; rm /tmp/sh$$1) &

before the "exec egrep" call. Nice program though!
-- 
David Fiedler {ames,bytepb,mrspoc,pyramid,ditka,hoptoad}!infopro!david
USMail:InfoPro Systems, PO Box 220 Rescue CA 95672 Phone:916/677-5870 FAX:-5873
"Don't worry...we'll fix it in post."

Dan_Jacobson@ATT.COM (08/19/90)

Tony_Hansen@ATT.COM and a few others pointed out to me that my recent
areacode shell script has the following poor taste:
:    o	It exec's egrep from a here-doc. This doesn't allow the shell to
:	clean up the temporary file that it has to create to pass to egrep.
:	Consequently, EVERY time the program is run, a file in /tmp gets
:	created and not removed. Either remove the "exec" or split the
:	program into two pieces: the shell and a separate data file which
:	contains the areacode information.

ok ok, I removed the exec [on the one I give to folks that e-mail me].
(total change (for those want to adjust their copies): deleted 4
characters and a blank.)

[On my computer there is no tmp file left over, but I believe you.]

:    o	The program is very slow because it has to recreate the temporary
:	data file every time the program is run.

Well "egrep string $0" doesn't work, as $0 is different in different
shells... and the `here document' (/bin/sh: "<<") is a nice way to keep
it together especially when you have no idea what on computers or in
what directories it will end up.  Other ways to deal with this don't
seem too elegant.
-- 
Dan_Jacobson@ATT.COM +1-708-979-6364