Dup Goto 📝

ExtendedGlobbing

PT2/aw/lang/bash bash glob pattern 07-31 13:46:40
To Pop
15 lines, 63 words, 490 chars Monday 2023-07-31 13:46:40

Summarised from https://www.linuxjournal.com/content/bash-extended-globbing

Enable via

$ shopt -s extglob

Then you can use

  ?(pattern-list)   Matches zero or one occurrence of the given patterns
  *(pattern-list)   Matches zero or more occurrences of the given patterns
  +(pattern-list)   Matches one or more occurrences of the given patterns
  @(pattern-list)   Matches one of the given patterns
  !(pattern-list)   Matches anything except one of the given patterns