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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
What are extended globs?5m 2s
-
(Locked)
Why you should use extended globs4m 37s
-
(Locked)
Make extended globs persistent1m 10s
-
(Locked)
Getting started with extended globs3m 4s
-
(Locked)
Pattern matching with extended globs5m 44s
-
(Locked)
Using extended globs with commands5m 1s
-
(Locked)
Comparing extended globs with regular expressions2m 22s
-
-
-
-
-
-
-
-