Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: comp.unix.shell Subject: Re: Question about 'test' Message-ID: <987@mwtech.UUCP> Date: 3 Dec 90 13:30:51 GMT References: <1990Nov21.191638.19469@athena.mit.edu> <1779@seti.inria.fr> Reply-To: martin@mwtech.UUCP (Martin Weitzel) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 38 In article <1779@seti.inria.fr> deschamp@seti.inria.fr writes: : :In article , :qpliu@phoenix.princeton.edu (q.p.liu) writes: : :|> trying /bin/[ shows that it only checks if argv[0] == "[". : : *Never* generalize :-). On my workstation (Sun 3/60 under SunOS 4.0.3): : $ test : $ [ : test: ] missing : :What I do not understand is this: : $ '[' : test: ] missing : $ PATH=/bin '[' : test: ] missing : $ /bin/[ : $ : :Why no complaint in the last case ? This shows exactly what original poster tried to say (as I understood). To make it a bit clearer, the source-code of "test" must look like if (!strcmp(argv[0], "[")) { if (strcmp(argv[--argc], "]") { /* complain about missing "]" and exit */ ..... } } /* parse arguments; run tests as required */ ..... In your last experiment argv[0] is "/bin/[" and not simply "[", hence no comlaint. -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83