In article <5ked69->,
Ben Morrow <> wrote:
>
>Quoth Mart van de Wege <>:
>> Mart van de Wege <> writes:
>>
>> > By default your current directory is not in the shell search path
>> > for executables. So if you execute 'test' from a shell prompt,
>> > the shell will search its path (held in the $PATH environment
>> > variable) to search for an executable named test. As it so
>> > happens, there is an executable named test in the path, and it
>> > lives in /bin.
>>
>> And as someone else helpfully pointed out, 'test' is not even in
>> the path, it's a shell built-in.
>
>This is not necessarily the case. POSIX /bin/sh has neither test nor
>[ built in, and therefore relies on them existing as executables in
>/bin. Many modern shells do provide them as builtins, and many
>(most? all?) modern systems install one of these shells as /bin/sh,
>though,
A bad practice that I've seen decryed. If you have a script that
depends on some feature of the original Bourne shell, or strict POSIX
compatibility, it's really nasty to have /bin/sh be something else.
Better, and I think (or at least hope more common) is to simply
provide a different login shell. For example, on my ISP,
tmcd:*:<uid>:<gid>:Tim McDaniel:<home directory>:/usr/local/bin/bash
>so it's likely you will see them as builtins.
And if not, as /bin/test and such -- and "." may yet be in your PATH
but at the end, so that /bin is hit first. I don't ever put "." in
PATH because it's a security hole on multi-user systems.
All this is a lot of detail. Short form:
- don't name a test program "test"
- invoke your own test programs with a path like ./foo or ~/foo
or /home/login/foo
--
Tim McDaniel,