glob(n) Tcl Built-In Commands glob(n) _________________________________________________________________ NAME glob - Return names of files that match patterns SYNOPSIS glob ?_s_w_i_t_c_h_e_s? _p_a_t_t_e_r_n ?_p_a_t_t_e_r_n ...? _________________________________________________________________ DESCRIPTION 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 _p_a_t_t_e_r_n arguments. If the initial arguments to glob start with - then they are treated as switches. The following switches are currently supported: -nocomplain Allows an empty list to be returned without error; without this switch an error is returned if the result list would be empty. -- Marks the end of switches. The argument following this one will be treated as a _p_a_t_- _t_e_r_n even if it starts with a -. The _p_a_t_t_e_r_n arguments may contain any of the following spe- cial characters: ? Matches any single character. * Matches any sequence of zero or more characters. [_c_h_a_r_s] Matches any single character in _c_h_a_r_s. If _c_h_a_r_s contains a sequence of the form _a-_b then any char- acter between _a and _b (inclusive) will match. \_x Matches the character _x. {_a,_b,...} Matches any of the strings _a, _b, 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 _p_a_t_t_e_r_n 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. Tcl Last change: 7.5 1 glob(n) Tcl Built-In Commands glob(n) The glob command differs from csh globbing in two ways. First, it does not sort its result list (use the lsort com- mand if you want the list sorted). Second, glob only returns the names of files that actually exist; in csh no check for existence is made unless a pattern contains a ?, *, or [] construct. PORTABILITY ISSUES Unlike other Tcl commands that will accept both network and native style names (see the filename manual entry for details on how native and network names are specified), the glob command only accepts native names. Also, for Windows UNC names, the servername and sharename components of the path may not contain ?, *, or [] constructs. KEYWORDS exist, file, glob, pattern Tcl Last change: 7.5 2