1mNAME0m
       glob - Return names of files that match patterns

1mSYNOPSIS0m
       1mglob 22m?4mswitches24m? 4mpattern24m ?4mpattern24m 4m...24m?


1mDESCRIPTION0m
       This  command  performs  file name ``globbing'' in a fashion similar to
       the csh shell.  It returns a list of the files whose names match any of
       the 4mpattern24m arguments.

       If  the initial arguments to 1mglob 22mstart with 1m- 22mthen they are treated as
       switches.  The following switches are currently supported:

       1m-directory 4m22mdirectory0m
              Search for files which match the given patterns starting in  the
              given  4mdirectory24m.   This  allows  searching of directories whose
              name contains glob-sensitive  characters  without  the  need  to
              quote  such  characters explicitly.  This option may not be used
              in conjunction with 1m-path22m.

       1m-join  22mThe remaining pattern arguments are treated as a single  pattern
              obtained by joining the arguments with directory separators.

       1m-nocomplain0m
              Allows an empty list to be returned without error;  without this
              switch an error is returned if the result list would be empty.

       1m-path 4m22mpathPrefix0m
              Search for files with the given 4mpathPrefix24m where the rest of the
              name  matches  the  given  patterns.   This allows searching for
              files with names similar to a given file  even  when  the  names
              contain  glob-sensitive characters.  This option may not be used
              in conjunction with 1m-directory22m.

       1m-types 4m22mtypeList0m
              Only list files or directories which match 4mtypeList24m,  where  the
              items  in  the  list have two forms.  The first form is like the
              -type option of the Unix find command: 4mb24m (block special file), 4mc0m
              (character special file), 4md24m (directory), 4mf24m (plain file), 4ml24m (sym-
              bolic link), 4mp24m (named pipe), or 4ms24m (socket), where multiple types
              may  be specified in the list.  1mGlob 22mwill return all files which
              match at least one of the types given.

              The second form specifies types where all the types  given  must
              match.   These  are  4mr24m,  4mw24m, 4mx24m as file permissions, and 4mreadonly24m,
              4mhidden24m as special permission cases.   On  the  Macintosh,  MacOS
              types  and  creators are also supported, where any item which is
              four characters long is assumed to be a MacOS type (e.g.  1mTEXT22m).
              Items  which are of the form 4m{macintosh24m 4mtype24m 4mXXXX}24m or 4m{macintosh0m
              4mcreator24m  4mXXXX}24m  will  match  types  or  creators   respectively.
              Unrecognised   types,   or   specifications  of  multiple  MacOS
              types/creators will signal an error.

              The two forms may be mixed, so 1m-types {d f r w}  22mwill  find  all
              regular  files OR directories that have both read AND write per-
              missions.  The following are equivalent:
                             1mglob -type d *0m
                             1mglob */0m
              except that the first case doesn't return the trailing ``/'' and
              is more platform independent.

       1m--     22mMarks the end of switches.  The argument following this one will
              be treated as a 4mpattern24m even if it starts with a 1m-22m.

       The 4mpattern24m arguments may contain any of the following special  charac-
       ters:

       1m?         22mMatches any single character.

       1m*         22mMatches any sequence of zero or more characters.

       1m[4m22mchars24m1m]   22mMatches  any  single character in 4mchars24m.  If 4mchars24m contains a
                 sequence of the form 4ma24m1m-4m22mb24m then any character between 4ma24m  and  4mb0m
                 (inclusive) will match.

       1m\4m22mx24m        Matches the character 4mx24m.

       1m{4m22ma24m1m,4m22mb24m1m,4m22m...24m} Matches any of the strings 4ma24m, 4mb24m, etc.

       As with csh, a  ``.'' at the beginning of a file's name or just after a
       ``/'' must be matched explicitly or with a {} construct.  In  addition,
       all ``/'' characters must be matched explicitly.

       If the first character in a 4mpattern24m is ``~'' then it refers to the home
       directory for the user whose name follows the ``~''.  If the  ``~''  is
       followed  immediately  by  ``/'' then the value of the HOME environment
       variable is used.

       The 1mglob 22mcommand differs from csh globbing in two ways.  First, it does
       not  sort  its  result list (use the 1mlsort 22mcommand if you want the list
       sorted).  Second, 1mglob 22monly returns the names of  files  that  actually
       exist;  in csh no check for existence is made unless a pattern contains
       a ?, *, or [] construct.


1mPORTABILITY ISSUES0m
       Unlike other Tcl commands that will  accept  both  network  and  native
       style  names  (see  the 1mfilename 22mmanual entry for details on how native
       and network names are specified), the 1mglob 22mcommand only accepts  native
       names.

       1mWindows0m
              For  Windows  UNC names, the servername and sharename components
              of the path may not contain ?, *, or [] constructs.  On  Windows
              NT,  if 4mpattern24m is of the form ``1m~4m22musername24m1m@4m22mdomain24m'' it refers to
              the home directory of the user whose account information resides
              on  the  specified  NT  domain  server.  Otherwise, user account
              information is obtained from the local computer.  On Windows  95
              and  98,  1mglob  22maccepts patterns like ``.../'' and ``..../'' for
              successively higher up parent directories.

       1mMacintosh0m
              When using the options, 1m-dir22m, 1m-join 22mor 1m-path22m, glob  assumes  the
              directory  separator  for  the  entire  pattern  is the standard
              ``:''.  When not using these options, glob examines each pattern
              argument and uses ``/'' unless the pattern contains a ``:''.


1mSEE ALSO0m
       file(n)


1mKEYWORDS0m
