Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!charon!dik From: dik@cwi.nl (Dik T. Winter) Newsgroups: comp.unix.shell Subject: Re: Question about 'test' Message-ID: <2640@charon.cwi.nl> Date: 4 Dec 90 12:15:50 GMT References: <1779@seti.inria.fr> <987@mwtech.UUCP> Sender: news@cwi.nl Organization: CWI, Amsterdam Lines: 31 In article <987@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: > In article <1779@seti.inria.fr> deschamp@seti.inria.fr writes: > :What I do not understand is this: > : $ '[' > : test: ] missing > : $ PATH=/bin '[' > : test: ] missing > : $ /bin/[ > : $ > > 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. Exactly, just try: [ -f foo ] and /bin/[ -f foo ] -- dik t. winter, cwi, amsterdam, nederland dik@cwi.nl