1 |
On 7/25/06, Alan McKinnon <alan@××××××××××××××××.za> wrote: |
2 |
> On Tue, 2006-07-25 at 16:18 +0200, Etaoin Shrdlu wrote: |
3 |
> > > test and [ are not links to each other as they have different syntax |
4 |
> > > (the closing ]), so they cannot be the same command. If they were |
5 |
> > > linked, one of them would fail on execution with invalid syntax |
6 |
> > errors |
7 |
> > |
8 |
> > This is not 100% true. As Neil Bothwick said, *the same program* can |
9 |
> > behave differently based on the name it was invoked with, so [ could |
10 |
> > very well have been implemented as a link to test (or viceversa), but |
11 |
> > this is not the case, as you can see with a |
12 |
> > ls -l /usr/bin/test /usr/bin/[ |
13 |
> |
14 |
> Um, no. Read my post again. The command 'test' and the command '[' have |
15 |
> *different* syntax so cannot possible be links to each other and still |
16 |
> have it work. The command does behave differently depending on the name |
17 |
> it is called with, but this does not change the syntax used on the |
18 |
> command line that invokes it. |
19 |
> |
20 |
|
21 |
Why not? The syntax is simply based on tests performed over the |
22 |
arguments received, the name of the program is one of those arguments, |
23 |
what stop the programmer to test the name and change the syntax |
24 |
accourding with that name? Many of my scripts behave differently |
25 |
accourding with the name it was called. That allows me to write simple |
26 |
tests, symlink the same program to different names and have different |
27 |
behavior/syntax, much better than copy the same file and edit it. |
28 |
|
29 |
-- |
30 |
Daniel da Veiga |
31 |
Computer Operator - RS - Brazil |
32 |
-----BEGIN GEEK CODE BLOCK----- |
33 |
Version: 3.1 |
34 |
GCM/IT/P/O d-? s:- a? C++$ UBLA++ P+ L++ E--- W+++$ N o+ K- w O M- V- |
35 |
PS PE Y PGP- t+ 5 X+++ R+* tv b+ DI+++ D+ G+ e h+ r+ y++ |
36 |
------END GEEK CODE BLOCK------ |
37 |
-- |
38 |
gentoo-user@g.o mailing list |