Created
September 7, 2019 15:00
-
-
Save thatisuday/e6c934167d370e70b1a060dd21e658e3 to your computer and use it in GitHub Desktop.
Bash extended globbing patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pattern | Description | Example Pattern | Explaination | Matches | |
---|---|---|---|---|---|
!(patterns) | Match anything that does not match the 'patterns' | !(photo).db | Match filenames without `photo` but next with `.db` | photophoto.db photos.db photoss.db photosss.db | |
?(patterns) | Match zero or one occurances of the 'patterns' | photo?(photo).db | Match filename with `photo` but next with optional `photo` | photo.db photophoto.db | |
*(patterns) | Match zero or more occurances of the 'patterns' | photo*(s).t* | Match filenames with `photo` but next 0 or more occurances of `s` | photo.txt photos.txt photoss.txt photosss.txt | |
+(patterns) | Match one or more occurances of the 'patterns' | photo+(s).txt | Match filenames with `photo` but next 1 or more occurances of `s` | photos.txt photoss.txt photosss.txt | |
@(patterns) | Match one occurance of the 'patterns' | photo@(s).db | Match filenames with `photo` but next exactly one occurance of `s` | photos.db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment