From the course: Bash Patterns and Regular Expressions
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Using brace expansion for patterns - Bash Tutorial
From the course: Bash Patterns and Regular Expressions
Using brace expansion for patterns
- The back-up files we used in chapter 2 of this course were created in part with brace expansion. Let's use braces to re-create some of those files. First, let's create a directory to make it easier to clean up. I'm going to do this exercise in the chapter 3 directory of the exercise files folder. You can do it anywhere you want. Let's call our new directory brace files and CD into it. Type in mkdir space and bracefiles and type in CD space bracefiles and hit enter. Now let's create some files, type in touch space Backup with a capital B dash 201 left curly bracket 1..9 right curly bracket, that takes care of the year. Hyphen left curly bracket 0 left curly bracket 0..9 right curly bracket comma 1 left curly bracket 1..2 right curly bracket right curly bracket. That takes care of the month. Hyphen left curly bracket 1..30 right curly bracket. That takes care of the day. Then for the extension, type in dot left curly bracket tar comma bak right curly bracket dot left curly bracket gz…
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.