However, using an expression such as [^b] where the shell is the one processing the pattern will cause trouble with shells that don't support that extension. The right way to express the negation is using an exclamation mark, as in: [!b]
Big fat note: this only applies to patterns that the shell is responsible for processing. Some of such cases are:
case foo in [!m]oo) echo bar ;; esacand
# everything but backups: for file in documents/*[!~]; do echo doing something with "$file" ... done
If the pattern is processed by another program, beware that most won't interpret the exclamation the way the shell does. E.g.
$ printf "foo\nbar\nbaz\n" | grep '^[^b]' foo $ printf "foo\nbar\nbaz\n" | grep '^[!b]' bar baz