963 shaares
2 results
tagged
patterns
BASH offers three different kinds of pattern matching. Pattern matching serves two roles in the shell: selecting filenames within a directory, or determining whether a string conforms to a desired format. On the command line you will mostly use globs. These are a fairly straight-forward form of patterns that can easily be used to match a range of files, or to check variables against simple rules. The second type of pattern matching involves extended globs, which allow more complicated expressions than regular globs.
How can I use a logical AND/OR/NOT in a shell pattern (glob)?
rm -- *.bak *.old
rm -- *.{bak,old}
rm -- *.bak *.old
rm -- *.{bak,old}