1. Home
  2. Computing & Technology
  3. Linux

Bash Guide For Beginners

From

3.4.9. File name expansion

After word splitting, unless the -f option has been set (see Section 2.3.2 ), Bash scans each word for the characters "*" , "?" , and "[" . If one of these characters appears, then the word is regarded as a PATTERN , and replaced with an alphabetically sorted list of file names matching the pattern. If no matching file names are found, and the shell option nullglob is disabled, the word is left unchanged. If the nullglob option is set, and no matches are found, the word is removed. If the shell option nocaseglob is enabled, the match is performed without regard to the case of alphabetic characters.

When a pattern is used for file name generation, the character "." at the start of a file name or immediately following a slash must be matched explicitly, unless the shell option dotglob is set. When matching a file name, the slash character must always be matched explicitly. In other cases, the "." character is not treated specially.

The GLOBIGNORE shell variable may be used to restrict the set of file names matching a pattern. If GLOBIGNORE is set, each matching file name that also matches one of the patterns in GLOBIGNORE is removed from the list of matches. The file names . and .. are always ignored, even when GLOBIGNORE is set. However, setting GLOBIGNORE has the effect of enabling the dotglob shell option, so all other file names beginning with a "." will match. To get the old behavior of ignoring file names beginning with a "." , make ".*" one of the patterns in GLOBIGNORE . The dotglob option is disabled when GLOBIGNORE is unset.


   Prev    Home    Next
   Quoting characters    Up    Aliases

* License

* Bash Guide For Beginners Index

Explore Linux
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux Documentation
  5. Bash Guide for Beginners
  6. Bash Guide For Beginners - 3.4.9. File name expansion

©2009 About.com, a part of The New York Times Company.

All rights reserved.