home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Unix / Shells / zsh / Source / help / getopts < prev    next >
Encoding:
Text File  |  1993-10-08  |  1.3 KB  |  24 lines

  1.        getopts optstring name [ arg ... ]
  2.               Checks arg for legal options.  If arg  is  omitted,
  3.               use  the  positional  parameters.   A  valid option
  4.               argument begins with a + or a -.  An  argument  not
  5.               beginning with a + or a -, or the argument --, ends
  6.               the options.  optstring contains the  letters  that
  7.               getopts  recognizes.   If a letter is followed by a
  8.               `:', that option is expected to have  an  argument.
  9.               The  options  can be separated from the argument by
  10.               blanks.
  11.  
  12.               Each time it is invoked, getopts places the  option
  13.               letter  it  finds  in  the  shell  parameter  name,
  14.               prepended with a + when arg begins with a  +.   The
  15.               index  of  the  next  arg is stored in OPTIND.  The
  16.               option argument, if any, is stored in OPTARG.
  17.  
  18.               A leading : in optstring causes  getopts  to  store
  19.               the  letter of the invalid option in OPTARG, and to
  20.               set name to `?' for an unknown option  and  to  `:'
  21.               when  a  required  option  is  missing.  Otherwise,
  22.               getopts prints an error message.  The  exit  status
  23.               is nonzero when there are no more options.
  24.