Pathname expansion
Jump to navigation
Jump to search
Pathname expansion is a process carried out by shells. It is also known as file globbing. A file glob (short for global) is a filename/directory name that contains wildcards. Three such wildcards are available:
- * is a wild string. It can contain any number of characters including none. Thus boot* will match boot, booting, bootloader, etc.
- ? is a single wild character. ?oot will match boot or root.
- [] is a single partially-wild character. This can be any of the characters inside the square brackets. Two characters separated by a dash (e.g. 0-9) represents a range of characters. file[123] will match file1, file2 or file3.
Wildcards do not normally match a dot at the beginning of a filename (the mark of a hidden file) but can be made to do so if the shell option dotglob is set.