conetfun
conetfun

Reputation: 1615

How this wildcard is working?

I am getting confused between following wildcard characters

  1. [:upper:]
  2. [[:upper:]]

Please explain how following commands are working?

enter image description here

Upvotes: 0

Views: 30

Answers (1)

Rob Napier
Rob Napier

Reputation: 299455

[:upper:] means "one of the characters of :, u, p, e, or r." Your first example finds the one thing that ends in e.

[[:upper:]] means "one of the characters in the upper class." Your pattern matches the one thing that ends in an upper case letter.

Your third example matches anything with at least one upper case letter in it.

From bash(1):

          Within  [  and  ],  character classes can be specified using the
          syntax [:class:], where class is one of  the  following  classes
          defined in the POSIX standard:
          alnum  alpha  ascii  blank  cntrl  digit graph lower print punct
          space upper word xdigit
          A character class matches any character belonging to that class.
          The  word character class matches letters, digits, and the char-
          acter _.

Note the "Within [ and ]...the syntax [:class:]..."

Upvotes: 2

Related Questions