home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v8 / text0026.txt < prev    next >
Encoding:
Text File  |  1987-06-30  |  1.7 KB  |  48 lines

  1. [ I'm not positive anything in this article has not been said before,
  2. but it's a useful summary.  -mod ]
  3.  
  4. From: nike!pyramid!pyrtech!trwrb!desint!geoff (Geoff Kuenning)
  5. Date: Wed, 29 Oct 86 01:02:04 pst
  6. Organization: SAH Consulting, Manhattan Beach, CA
  7.  
  8. In article <6110@ut-sally.UUCP> weemba@brahms.berkeley.edu (Matthew P Wiener)
  9. writes:
  10.  
  11. > Date: Fri, 24 Oct 86 14:27:50 PDT
  12. > Organization: University of California, Berkeley
  13. > In article <6029@ut-sally.UUCP> Mark Horton writes:
  14. > >    Since many commands take names beginning with "-" as flags,
  15. > >        file names beginning with "-" don't always work.
  16. > There's a real easy fix to the current random collection of special
  17. > flags that handle filenames beginning with a dash: always interpret
  18. > two dashes at the beginning of a command line argument as the name for
  19. > the file obtained by eliding the two dashes into one.  Thus
  20.  
  21. There're at least two reasons not to do this:  (1) it's unnecessary, and
  22. (2) it conflicts with the standard already established for getopt(3).
  23.  
  24. It's unnecessary because you can *always* specify a file beginning with
  25. "-" as "./-file".  I find this much easier to remember.
  26.  
  27. The second reason is that getopt(3) already explicitly defines an argument
  28. of "--" as delimiting the end of the switches.  It is provided specifically
  29. to handle the case when an argument begins with a dash.
  30.  
  31. Thus, for example, to grep(1) for commands that take a "-i" switch, we
  32. would use:
  33.  
  34.     egrep -- -i /usr/man/u_man/man1/*
  35.  
  36. (Note that this applies only on System V;  BSD uses an older convention.
  37. Also note that some System V documentation incorrectly lists the obsolete
  38. "-e" switch for this purpose;  "-e" doesn't work, but "--" does.)
  39. -- 
  40.  
  41.     Geoff Kuenning
  42.     {hplabs,ihnp4}!trwrb!desint!geoff
  43.  
  44. Volume-Number: Volume 8, Number 27
  45.  
  46.