From the course: Linux: Files and Permissions
Unlock the full course today
Join today to access over 25,200 courses taught by industry experts.
Matching with brace expansion - Linux Tutorial
From the course: Linux: Files and Permissions
Matching with brace expansion
- [Instructor] We can match most files using standard globs but sometimes it gets a bit messy because we can only match one character at a time. For instance, a character set with jm in it followed by pg will match both JPG and MPG. That's simple enough. However, if you want to match JPG and PNG, it's gets more complex and less precise. We can use two character sets, one with jp and the other was pn followed by a lone g. This will match JPG and PNG, but also JNG and PPG, which is not as precise as we'd like. The Bash shell provides another technology called brace expansion that is not technically globbing but we can use it to our advantage. Globbing is referred to as pattern matching. When we use a glob, the shell looks for files that match the pattern in the file system. Brace expansion is pattern creation because it expands to create a pattern as if we'd typed it in. For instance, echo space left curly brace 1..10…
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 is a file?4m 59s
-
(Locked)
Getting information about files5m 29s
-
(Locked)
About extended attributes3m 54s
-
(Locked)
Getting extended attributes4m 14s
-
(Locked)
About file globs5m 9s
-
(Locked)
Using character classes3m 7s
-
(Locked)
Using globs to match files6m 42s
-
(Locked)
Matching with brace expansion6m 11s
-
(Locked)
The Magic of extended globs6m 25s
-
(Locked)
Matching files with extended globs2m 22s
-
(Locked)
Advanced extended globs4m 22s
-
-
-
-
-