Monday, 14 August 2017

Bash Pathname Expansion

Cited from the Book "Pro Bash Programming"

Unquoted words on the command line containing the characters *, ?, and [ are treated as file globbing patterns and are replaced by an alphabetical list of files that match the pattern. If no files match the pattern, the word is left unchanged.

Square brackets match any one of the enclosed characters, which may be a list, a range, or a class of
characters: [aceg] matches any one of a, c, e, or g; [h-o] matches any character from h to o inclusive; and [[:lower:]] matches all lowercase letters.

You can disable file name expansion with the set -f command.

No comments:

Post a Comment