[net.unix-wizards] . files and interactiveness

hanss (10/28/82)

I think the point that gordon was trying to make by distinguishing
interactive programs with non interactive ones is valid, although
I disagree with him on doing away with . files.  The shell
and editor are obviously interactive sometimes, and obviously
filters at other times.  When filters are built with other tools,
they should NEVER rely on any particular environment.  you can never
tell who or what may be running these things, or what random program
may be lying around waiting to be executed by some unsuspecting user.
This is particularly important now that many of the system III utilities,
such as make, know about the diversity of shells.

My favorite example is when I ran a local system utility in background that
happened to be a bourne shell script that used the test command.  I was running
it from a directory in which I was running a test program uncharacteristicly
called 'test'.  I suddenly started getting screenfuls of some obscure
garbage on my screen, which turned out to be my test program with garbage input.

The point is that the author of the shell script should have explicitly
set PATH to something containing only the directorys where the 'test'
he was expecting would be, or explicitly have referred to /bin/test.
Obviously this rule holds for aliases and any of the other things people
put into .cshrcs, .exrcs, or .foorcs.  It may perhaps hold less for
filters created 'on the fly', but I dont think thats hard to handle.
The bourne shell seems to be able to tell when its interactive without
a hitch.  csh and berkeley ls (for example) dont do as well, but they are
close most of the time.  I would much rather have an explicit 'source' command
in my interactive session than have some unexpected thing happen to a script.
In particular, I think that when a shell comes up non-interactive, it  should
set its path to /bin:/usr/bin (current working directory not included),
and that it should not read .cshrc.

I also think that there should be some standard symbol in the front of all
shell scripts, such as csh's #, but probably more verbose and more precise
so we dont run out 5 years from now.  We are running four and two half shells
around here now (that I know of) and the trend shows no sign of diminishing.
(the halfs are various hacked bourne shells)  I propose #/bin/sh and
#/bin/csh as the syntax for the obvious...  Sadly bourne shell scripts have
to allow the default anonimity for compatability.

			Not afraid to speak for myself at great length
			-Hans Spiller
			decvax!microsoft!hanss