On 7/25/06, Alan McKinnon <[EMAIL PROTECTED]> wrote:
On Tue, 2006-07-25 at 16:18 +0200, Etaoin Shrdlu wrote:
> > 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
>
> This is not 100% true. As Neil Bothwick said, *the same program* can
> behave differently based on the name it was invoked with, so [ could
> very well have been implemented as a link to test (or viceversa), but
> this is not the case, as you can see with a
> ls -l /usr/bin/test /usr/bin/[

Um, no. Read my post again. The command 'test' and the command '[' have
*different* syntax so cannot possible be links to each other and still
have it work. The command does behave differently depending on the name
it is called with, but this does not change the syntax used on the
command line that invokes it.


Why not? The syntax is simply based on tests performed over the
arguments received, the name of the program is one of those arguments,
what stop the programmer to test the name and change the syntax
accourding with that name? Many of my scripts behave differently
accourding with the name it was called. That allows me to write simple
tests, symlink the same program to different names and have different
behavior/syntax, much better than copy the same file and edit it.

--
Daniel da Veiga
Computer Operator - RS - Brazil
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/IT/P/O d-? s:- a? C++$ UBLA++ P+ L++ E--- W+++$ N o+ K- w O M- V-
PS PE Y PGP- t+ 5 X+++ R+* tv b+ DI+++ D+ G+ e h+ r+ y++
------END GEEK CODE BLOCK------
--
gentoo-user@gentoo.org mailing list

Reply via email to