OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man7 / glob.7
index e8a3f43..77c18b6 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright (c) 1998 Andries Brouwer
 .\"
+.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
 .\" This is free documentation; you can redistribute it and/or
 .\" modify it under the terms of the GNU General Public License as
 .\" published by the Free Software Foundation; either version 2 of
 .\" GNU General Public License for more details.
 .\"
 .\" You should have received a copy of the GNU General Public
-.\" License along with this manual; if not, write to the Free
-.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
-.\" USA.
+.\" License along with this manual; if not, see
+.\" <http://www.gnu.org/licenses/>.
+.\" %%%LICENSE_END
 .\"
 .\" 2003-08-24 fix for / by John Kristoff + joey
 .\"
-.TH GLOB 7 2003-08-24 "Linux" "Linux Programmer's Manual"
+.TH GLOB 7 2012-07-28 "Linux" "Linux Programmer's Manual"
 .SH NAME
-glob \- Globbing pathnames
+glob \- globbing pathnames
 .SH DESCRIPTION
-Long ago, in Unix V6, there was a program
+Long ago, in UNIX\ V6, there was a program
 .I /etc/glob
 that would expand wildcard patterns.
-Soon afterwards this became a shell built-in.
+Soon afterward this became a shell built-in.
 
 These days there is also a library routine
 .BR glob (3)
 that will perform this function for a user program.
 
 The rules are as follows (POSIX.2, 3.13).
-.SS "Wildcard Matching"
+.SS Wildcard matching
 A string is a wildcard pattern if it contains one of the
 characters \(aq?\(aq, \(aq*\(aq or \(aq[\(aq.
 Globbing is the operation
@@ -99,16 +100,17 @@ If a filename starts with a \(aq.\(aq,
 this character must be matched explicitly.
 (Thus, \fIrm\ *\fP will not remove .profile, and \fItar\ c\ *\fP will not
 archive all your files; \fItar\ c\ .\fP is better.)
-.SS "Empty Lists"
+.SS Empty lists
 The nice and simple rule given above: "expand a wildcard pattern
-into the list of matching pathnames" was the original Unix
+into the list of matching pathnames" was the original UNIX
 definition.
 It allowed one to have patterns that expand into
 an empty list, as in
-.br
+
 .nf
     xv \-wait 0 *.gif *.jpg
 .fi
+
 where perhaps no *.gif files are present (and this is not
 an error).
 However, POSIX requires that a wildcard pattern is left
@@ -116,20 +118,24 @@ unchanged when it is syntactically incorrect, or the list of
 matching pathnames is empty.
 With
 .I bash
-one can force the classical behavior by setting
-.IR allow_null_glob_expansion=true .
+one can force the classical behavior using this command:
+
+    shopt \-s nullglob
+.\" In Bash v1, by setting allow_null_glob_expansion=true
 
 (Similar problems occur elsewhere.
-E.g., where old scripts have
-.br
+For example, where old scripts have
+
 .nf
     rm \`find . \-name "*~"\`
 .fi
+
 new scripts require
-.br
+
 .nf
     rm \-f nosuchfile \`find . \-name "*~"\`
 .fi
+
 to avoid error messages from
 .I rm
 called with an empty argument list.)
@@ -145,11 +151,11 @@ more copies of the preceding thing.
 Now that regular expressions have bracket expressions where
 the negation is indicated by a \(aq^\(aq, POSIX has declared the
 effect of a wildcard pattern "\fI[^...]\fP" to be undefined.
-.SS Character classes and Internationalization
+.SS Character classes and internationalization
 Of course ranges were originally meant to be ASCII ranges,
 so that "\fI[\ \-%]\fP" stands for "\fI[\ !"#$%]\fP" and "\fI[a\-z]\fP" stands
 for "any lowercase letter".
-Some Unix implementations generalized this so that a range X\-Y
+Some UNIX implementations generalized this so that a range X\-Y
 stands for the set of characters with code between the codes for
 X and for Y.
 However, this requires the user to know the
@@ -197,13 +203,20 @@ where the string between "\fI[=\fP" and "\fI=]\fP" is any collating
 element from its equivalence class, as defined for the
 current locale.
 For example, "\fI[[=a=]]\fP" might be equivalent
-.\" FIXME . the accented 'a' characters are not rendering properly
-.\" mtk May 2007
-to "\fI[aáàäâ]\fP" (warning: Latin-1 here), that is,
+to "\fI[a\('a\(`a\(:a\(^a]\fP", that is,
 to "\fI[a[.a-acute.][.a-grave.][.a-umlaut.][.a-circumflex.]]\fP".
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR sh (1),
 .BR fnmatch (3),
 .BR glob (3),
 .BR locale (7),
 .BR regex (7)
+.SH COLOPHON
+This page is part of release 3.68 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.