课程: Linux CentOS 7: Shells and Processes
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Pattern matching with extended globs - Linux教程
课程: Linux CentOS 7: Shells and Processes
Pattern matching with extended globs
- [Narrator] In addition to standard globs, bash allows us to use extended globs. This is an option that may be turned off in your version of Linux . Check to see if it's turned on, type in a terminal, shopt and hit enter. Look through the list and find extglob and ensure that's turned on. If it is not turned on you'll need to type in shopt -s extglob and hit enter. To make this persistent, you'll need to put it in your bash or C startup file. Extended globs give us more pattern matching power. They grant us the power to specify the number of occurrences to match, which is difficult to do with standard globs. They also allow grouping matches. Patterns can be more than one character. If we want to match three occurrences of ABC, we could. They also allow us to match one pattern or another. With extending globbing we can specify zero or one occurrences of a match. For instance, if we want to match zero or one occurrence…