Question about 'test' (Was Re: testing if a file is present)
Jonathan I. Kamens
jik at athena.mit.edu
Mon Dec 3 08:15:07 AEST 1990
In article <1990Dec2.210141.13170 at athena.mit.edu>, I write:
|> In article <QPLIU.90Nov29205347 at phoenix.princeton.edu>, qpliu at 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 at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
More information about the Comp.unix.shell
mailing list