Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!snorkelwacker.mit.edu!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.shell Subject: Re: Question about 'test' (Was Re: testing if a file is present) Message-ID: <1990Dec2.211507.13453@athena.mit.edu> Date: 2 Dec 90 21:15:07 GMT References: <1990Nov21.191638.19469@athena.mit.edu> <1990Dec2.210141.13170@athena.mit.edu> Sender: daemon@athena.mit.edu (Mr Background) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 22 In article <1990Dec2.210141.13170@athena.mit.edu>, I write: |> In article , qpliu@phoenix.princeton.edu (q.p.liu) writes: |> |> trying /bin/[ shows that it only checks if argv[0] == "[". |> |> Then either you did something wrong, or you're using a buggy version of |> "test." I corrected q.p.liu because I misunderstood what he was saying, and just realized this, so I'd like to apologize. He was saying, "`Test' only checks if the final `]' is present if it is invoked with argv[0] exactly equal to `['." I thought he was saying, "`Test' only checks if its argv[0] is exactly equal to `['; it does not also check if the final ']' is present." Liu is right, of course. Whether or not this behavior of "test" (i.e. the distinguishing between "[" and "/bin/[") is correct is debatable, but I believe that it is. -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710