On Tue, 25 Jul 2006 15:41:56 +0200, Alan McKinnon wrote:

> The answer is simple:

Maye, but this isn't it.

> 'test' is a bash builtin. When a bash script executes 'test', it is
> not /usr/bin/test that runs, but a function internal to bash.

test and [ are both Bash builtins, but there are also [ and test commands
in /usr/bin. This has nothing to do with the builtins.


> /usr/bin/test/ is provided for environments that want to run bash
> scripts that use test but bash is not the shell in use.

Those scripts can also use /usr/bin/[

> test and [ are not links to each other as they have different syntax
> (the closing ]), so they cannot be the same command. If they were
> linked, one of them would fail on execution with invalid syntax errors

That's wrong, as explained in my previous response that you quoted. A
command receives the name it was invoked with as one of its arguments. So
it is possible for a command to operate differently according to the name
used to run it, such as the gzip/gunzip/zcat example I gave earlier, or
the hundreds of commends in netpbm that are mainly symlinks to a few core
commands.

It's possible to do this with scripts too, I have a number of scripts
that act differently according to the name used to run them.


-- 
Neil Bothwick

Plagarism prohibited. Derive carefully.

Attachment: signature.asc
Description: PGP signature

Reply via email to