home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / shell / 3073 < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.3 KB  |  33 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!odin!chet
  3. From: chet@odin.INS.CWRU.Edu (Chet Ramey)
  4. Subject: Re: [ vs. [[ in ksh
  5. Message-ID: <1992Jul21.114928.12787@usenet.ins.cwru.edu>
  6. Sender: news@usenet.ins.cwru.edu
  7. Nntp-Posting-Host: odin.ins.cwru.edu
  8. Organization: Case Western Reserve University, Cleveland, OH (USA)
  9. References: <1992Jul16.055054.20973@ddsw1.mcs.com> <1992Jul16.180423.7628@u.washington.edu> <Brp7Lr.AI5@root.co.uk>
  10. Date: Tue, 21 Jul 92 11:49:28 GMT
  11. Lines:       21
  12.  
  13. In article <Brp7Lr.AI5@root.co.uk> gwc@root.co.uk (Geoff Clare) writes:
  14.  
  15. >The work-around for this one is [ X"$X" = X"$Y" ], which is pretty robust.
  16. >However, there are some things that are even harder to protect against,
  17. >and you begin to wonder whether it's worth it.  Consider [ -f "$FILE" ],
  18. >a very common usage, and what happens when FILE contains `='.
  19.  
  20. The Posix.2 specification of test contains a much more robust algorithm
  21. based on the number of arguments to the test command that avoids many
  22. of the traditional problems.
  23.  
  24. Bash implements this algorithm; so does the standalone GNU shellutils
  25. `test'.
  26.  
  27. Chet
  28. -- 
  29. ``The use of history as therapy means the corruption of history as history.''
  30.     -- Arthur Schlesinger
  31.  
  32. Chet Ramey, Case Western Reserve University    Internet: chet@po.CWRU.Edu
  33.