zoukankan      html  css  js  c++  java
  • 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])).

  • 相关阅读:
    override new virtual 的比较
    c#页面无内容解决方案
    插入排序
    排序算法(转)
    treenode遍历文件夹
    案例篇(1)
    索引器(转)
    迭代器的实现
    抽象类和接口的区别
    索引器与迭代器,属性的区别
  • 原文地址:https://www.cnblogs.com/winditsway/p/14473295.html
Copyright © 2011-2022 走看看