From the course: Bash Patterns and Regular Expressions

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Using extended globs with commands

Using extended globs with commands - Bash Tutorial

From the course: Bash Patterns and Regular Expressions

Using extended globs with commands

- [Instructor] Now we'll use some extended globs with some commands instead of just matching file names. Make sure you're in your test files directory that we created earlier in the chapter. My path is slash home slash user one slash exercise files slash chapter two slash test files. Now let's do some pattern matching with some destructive commands. In the last video we matched the archive and backup files, which looks like this. Now let's invert this glob by encapsulating it with an inversion glob. This will show us the files that the glob does not match. Prepend the glob with exclamation point, left parentheses, asterisk. And then go to the end of the glob and add asterisk, right parentheses, and hit enter. This brings up three files. Two of the files appear to be backup files but don't have a day field in their name. These files are problematic because they don't follow the pattern of our other files. We don't know which day they were created on but we can add an arbitrary day into…

Contents