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.

Why you should use extended globs

Why you should use extended globs - Bash Tutorial

From the course: Bash Patterns and Regular Expressions

Why you should use extended globs

- [Instructor] It may not be clear why you'd want to use extended globs yet. The first and most obvious answer is that they make interactive globbing more powerful on the command line. For instance, in one quick command stream you could delete all photos in a directory that are not stored in Canon or Nikon Raw format. This is rather difficult to do with a GUI or using standard globs. The second reason is that they add more power to if conditional statements and scripts. For example, we could use an extended glob in an if conditional to match a specific pattern of files. You may be wondering why we'd do this since we have regular expression matching with this type of if conditional. In short, it executes faster. I'll say more about that in a moment. The next reason is that extended globs add power to case statements. This addition can be epic because we can't use regular expression in case statements, and standard globs aren't very powerful. Depending on the circumstance, the speed…

Contents