• Learning_the_bash_Shell_Third_Edition 7/n(chapter 4, page[117|99])


    Extended Pattern Matching

    Operator

    Meaning

    *(patternlist)

    Matches zero or more occurrences of the given patterns.

    +(patternlist)

    Matches one or more occurrences of the given patterns.

    ?(patternlist)

    Matches zero or one occurrences of the given patterns.

    @(patternlist)

    Matches exactly one of the given patterns.

    !(patternlist)

    Matches anything except one of the given patterns.

    Some examples of these include:

    *(alice|hatter|hare) would match zero or more occurrences of alice, hatter, and hare. So it would match the null string, alice, alicehatter, etc.

    +(alice|hatter|hare) would do the same except not match the null string.

    ?(alice|hatter|hare) would only match the null string, alice, hatter, or hare.

    @(alice|hatter|hare) would only match alice, hatter, or hare.

    !(alice|hatter|hare) matches everything except alice, hatter, and hare.

    The values provided can contain shell wildcards too. So, for example, +([0-9]) matches a number of one or more digits. The patterns can also be nested, so you could remove all files except those beginning with vt followed by a number by doing rm !(vt+([0-9])).

  • 相关阅读:
    小程序中自定义组件
    rem是如何实现自适应布局的?
    基于vue前端状态管理模式
    vue项目使用keep-alive的作用
    JS移动元素的方法
    es6 promise then对异常处理的方法
    async/await 中await接收的promise的问题
    angularjs ngRoute demo
    angularjs $watch demo
    Html5 Geolocation demo
  • 原文地址:https://www.cnblogs.com/winditsway/p/14473295.html
Copyright © 2020-2023  润新知