In article <100127320....@PointedEars.de>,
Thomas 'PointedEars' Lahn <use...@PointedEars.de> wrote:
>Kaz Kylheku wrote:
>
>> What is rather surprising is that . use the PATH *at all*.
>> How stupid, really.
>
>No, as I only discovered recently, it is very useful for includes, i.e. code
>reuse (here: ~/bin/includes/).
I don't think anyone is denying that having . searching some kind of
path-ish variable could be useful, in some circumstances. However, my
sense is that it is actually a rarely used functionality; most people do not
go that far into shell programming. When you start getting that far into
it, it is usually time to switch to a more sane language (e.g., AWK, Perl,
etc).
Rather, the problem is that it double-teams on the usual executable "PATH"
variable. There's no particularly good reason for that; they should have
used a different variable (e.g., FPATH or whatever it is in "ksh").
Furthermore, I think the usual "Not having . in PATH" issue shouldn't apply
here. I, of course, understand fully the reasons why the current directory
should not be in the executable $PATH, but there's simply no reason why the
following should not behave as expected:
$ cd /tmp
$ echo 'echo hello' > ls
$ . ls
As you can see, with this example, I am arguing all of the following:
1) It should use some other variable (not $PATH, which finds, surprise!
surprise! executables). There's no sensible reason why shell
source files should be intermixed with binary executables in, say
/bin, /usr/bin, etc.
and
2) The current directory should always be searched first, because
that's what people expect with the . command. This is different
from the expected behavior for a normal executables search.
and
3) It seems pretty clear to me that what happened is that very early
on, when Unix was young, somebody decided it would be a good idea
to have a search path for . files, but didn't really think it
through and just decided to re-use $PATH for that purpose. This
can be seen now to have been a bad decision.
--
"We should always be disposed to believe that which appears to us to be
white is really black, if the hierarchy of the church so decides."
- Saint Ignatius Loyola (1491-1556) Founder of the Jesuit Order -