{"id":6148,"date":"2022-12-20T18:57:58","date_gmt":"2022-12-20T21:57:58","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/glob-mann\/"},"modified":"2022-12-20T18:57:58","modified_gmt":"2022-12-20T21:57:58","slug":"glob-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/glob-mann\/","title":{"rendered":"glob (mann)"},"content":{"rendered":"<h1 align=\"center\">glob<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#WINDOWS PORTABILITY ISSUES\">WINDOWS PORTABILITY ISSUES<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">glob \u2212 Return names of files that match patterns<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>glob<\/b> ?<i>switches<\/i>? ?<i>pattern &#8230;<\/i>? ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This command performs file name \u201cglobbing\u201d in a fashion similar to the csh shell or bash shell. It returns a list of the files whose names match any of the <i>pattern<\/i> arguments. No particular order is guaranteed in the list, so if a sorted list is required the caller should use <b>lsort<\/b>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>OPTIONS<\/b> <br \/> If the initial arguments to <b>glob<\/b> start with <b>\u2212<\/b> then they are treated as switches. The following switches are currently supported: <b><br \/> \u2212directory<\/b> <i>directory<\/i><\/p>\n<p style=\"margin-left:22%;\">Search for files which match the given patterns starting in the given <i>directory<\/i>. 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 <b>\u2212path<\/b>, which is used to allow searching for complete file paths whose names may contain glob-sensitive characters.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"7%\">\n<p><b>\u2212join<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"78%\">\n<p>The remaining pattern arguments, after option processing, are treated as a single pattern obtained by joining the arguments with directory separators.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>\u2212nocomplain<\/b><\/p>\n<p style=\"margin-left:22%;\">Allows an empty list to be returned without error; without this switch an error is returned if the result list would be empty.<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212path<\/b> <i>pathPrefix<\/i><\/p>\n<p style=\"margin-left:22%;\">Search for files with the given <i>pathPrefix<\/i> where the rest of the name matches the given patterns. This allows searching for files with names similar to a given file (as opposed to a directory) even when the names contain glob-sensitive characters. This option may not be used in conjunction with <b>\u2212directory<\/b>. For example, to find all files with the same root name as $path, but differing extensions, you should use \u201c<b>glob \u2212path [file rootname $path] .*<\/b>\u201d which will work even if <b>$path<\/b> contains numerous glob-sensitive characters.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212tails<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>Only return the part of each file found which follows the last directory named in any <b>\u2212directory<\/b> or <b>\u2212path<\/b> path specification. Thus \u201c<b>glob \u2212tails \u2212directory $dir *<\/b>\u201d is equivalent to \u201c<b>set pwd [pwd]; cd $dir; glob *; cd $pwd<\/b>\u201d. For <b>\u2212path<\/b> specifications, the returned names will include the last path segment, so \u201c<b>glob \u2212tails \u2212path [file rootname ~\/foo.tex] .*<\/b>\u201d will return paths like <b>foo.aux foo.bib foo.tex<\/b> etc.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>\u2212types<\/b> <i>typeList<\/i><\/p>\n<p style=\"margin-left:22%;\">Only list files or directories which match <i>typeList<\/i>, where the items in the list have two forms. The first form is like the \u2212type option of the Unix find command: <i>b<\/i> (block special file), <i>c<\/i> (character special file), <i>d<\/i> (directory), <i>f<\/i> (plain file), <i>l<\/i> (symbolic link), <i>p<\/i> (named pipe), or <i>s<\/i> (socket), where multiple types may be specified in the list. <b>Glob<\/b> will return all files which match at least one of the types given. Note that symbolic links will be returned both if <b>\u2212types l<\/b> is given, or if the target of a link matches the requested type. So, a link to a directory will be returned if <b>\u2212types d<\/b> was specified.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The second form specifies types where all the types given must match. These are <i>r<\/i>, <i>w<\/i>, <i>x<\/i> as file permissions, and <i>readonly<\/i>, <i>hidden<\/i> 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. <b>TEXT<\/b>). Items which are of the form <i>{macintosh type XXXX}<\/i> or <i>{macintosh creator XXXX}<\/i> will match types or creators respectively. Unrecognized types, or specifications of multiple MacOS types\/creators will signal an error.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">The two forms may be mixed, so <b>\u2212types {d f r w}<\/b> will find all regular files OR directories that have both read AND write permissions. The following are equivalent:<\/p>\n<p style=\"margin-left:32%; margin-top: 1em\"><b>glob \u2212type d bodies manpages.csv script_extrae_body.sh script.sh usr <br \/> glob *\/<\/b><\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">except that the first case doesn\u2019t return the trailing \u201c\/\u201d and is more platform independent.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><b>\u2212\u2212<\/b><\/p>\n<\/td>\n<td width=\"8%\"><\/td>\n<td width=\"78%\">\n<p>Marks the end of switches. The argument following this one will be treated as a <i>pattern<\/i> even if it starts with a <b>\u2212<\/b>.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>GLOBBING PATTERNS<\/b> <br \/> The <i>pattern<\/i> arguments may contain any of the following special characters, which are a superset of those supported by <b>string match<\/b>:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"14%\">\n<p style=\"margin-top: 1em\"><b>?<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"74%\">\n<p style=\"margin-top: 1em\">Matches any single character.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"14%\">\n<p><b>*<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"74%\">\n<p>Matches any sequence of zero or more characters.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"14%\">\n<p><b>[<\/b><i>chars<\/i><b>]<\/b><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"74%\">\n<p>Matches any single character in <i>chars<\/i>. If <i>chars<\/i> contains a sequence of the form <i>a<\/i><b>\u2212<\/b><i>b<\/i> then any character between <i>a<\/i> and <i>b<\/i> (inclusive) will match.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"14%\">\n<p><b><\/b><i>x<\/i><\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"74%\">\n<p>Matches the character <i>x<\/i>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"14%\">\n<p><b>{<\/b><i>a<\/i><b>,<\/b><i>b<\/i><b>,<\/b><i>&#8230;<\/i>}<\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"74%\">\n<p>Matches any of the sub-patterns <i>a<\/i>, <i>b<\/i>, etc.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">On Unix, as with csh, a \u201c.\u201d at the beginning of a file\u2019s name or just after a \u201c\/\u201d must be matched explicitly or with a {} construct, unless the <b>\u2212types hidden<\/b> flag is given (since \u201c.\u201d at the beginning of a file\u2019s name indicates that it is hidden). On other platforms, files beginning with a \u201c.\u201d are handled no differently to any others, except the special directories \u201c.\u201d and \u201c..\u201d which must be matched explicitly (this is to avoid a recursive pattern like \u201cglob \u2212join bodies manpages.csv script_extrae_body.sh script.sh usr bodies manpages.csv script_extrae_body.sh script.sh usr bodies manpages.csv script_extrae_body.sh script.sh usr *\u201d from recursing up the directory hierarchy as well as down). In addition, all \u201c\/\u201d characters must be matched explicitly.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If the first character in a <i>pattern<\/i> is \u201c~\u201d then it refers to the home directory for the user whose name follows the \u201c~\u201d. If the \u201c~\u201d is followed immediately by \u201c\/\u201d then the value of the HOME environment variable is used.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>glob<\/b> command differs from csh globbing in two ways. First, it does not sort its result list (use the <b>lsort<\/b> command if you want the list sorted). Second, <b>glob<\/b> only returns the names of files that actually exist; in csh no check for existence is made unless a pattern contains a ?, *, or [] construct.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">When the <b>glob<\/b> command returns relative paths whose filenames start with a tilde \u201c~\u201d (for example through <b>glob *<\/b> or <b>glob \u2212tails<\/b>, the returned list will not quote the tilde with \u201c.\/\u201d. This means care must be taken if those names are later to be used with <b>file join<\/b>, to avoid them being interpreted as absolute paths pointing to a given user\u2019s home directory.<\/p>\n<h2>WINDOWS PORTABILITY ISSUES <a name=\"WINDOWS PORTABILITY ISSUES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">For Windows UNC names, the servername and sharename components of the path may not contain ?, *, or [] constructs. On Windows NT, if <i>pattern<\/i> is of the form \u201c<b>~<\/b><i>username<\/i><b>@<\/b><i>domain<\/i>\u201d, 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.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Since the backslash character has a special meaning to the glob command, glob patterns containing Windows style path separators need special care. The pattern \u201c<i>C:\\foo\\*<\/i>\u201d is interpreted as \u201c<i>C:foo*<\/i>\u201d where \u201c<i>f<\/i>\u201d will match the single character \u201c<i>f<\/i>\u201d and \u201c<i>*<\/i>\u201d will match the single character \u201c<i>*<\/i>\u201d and will not be interpreted as a wildcard character. One solution to this problem is to use the Unix style forward slash as a path separator. Windows style paths can be converted to Unix style paths with the command \u201c<b>file join $path<\/b>\u201d or \u201c<b>file normalize $path<\/b>\u201d.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Find all the Tcl files in the current directory:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>glob<\/b> *.tcl<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Find all the Tcl files in the user\u2019s home directory, irrespective of what the current directory is:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>glob<\/b> \u2212directory ~ *.tcl<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Find all subdirectories of the current directory:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>glob<\/b> \u2212type d *<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Find all files whose name contains an \u201ca\u201d, a \u201cb\u201d or the sequence \u201ccde\u201d:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>glob<\/b> \u2212type f *{a,b,cde}*<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">file(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">exist, file, glob, pattern<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  glob \u2212 Return names of files that match patterns <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[1055,2635],"class_list":["post-6148","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-glob","tag-mann"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6148"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6148\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}