On Tue, 2006-07-25 at 14:16 +0100, Neil Bothwick wrote: > On Tue, 25 Jul 2006 09:26:52 -0300, Mauro Faccenda wrote: > > > > > You see? They cant be the same, because the closing "]" is needed > > > > by /usr/bin[ and not by /usr/bin/test > > > > > > It's quite common for a program to change its behaviour according to > > > the name used to run it. For example, zcat and gunzip are links to > > > gzip, yet the three programs behave differently. > > > > but this isn't the case: > > I was disagreeing with the "cant be the same" comment. I know they are > different files, but the slightly different behaviour is insufficient > reason for that. Alexander asked why one was not a link to the other, I'd > like to know too, but this isn't the reason.
For such a simple question, this sure is generating a lot of traffic :-) The answer is simple: '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. /usr/bin/test/ is provided for environments that want to run bash scripts that use test but bash is not the shell in use. 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 alan -- gentoo-user@gentoo.org mailing list