swcarpentry/bc — pull request #257 by wking (2014-01-26 00:32:58+00:00)
Title: lessons/ref/shell.html: Drop the [!...] POSIX shell syntax

I was surprised by this so I looked it up. It turns out that the
POSIX shell does indeed buck the standard RE syntax [1] by changing
from a circumflex (^) to an exclamation point (!) [2]. As far as
POSIX is concerned, '[^...]' is undefined. Luckily for me, Bash
accepts both forms (see the "Pattern Matching" section of bash(1)). Is
it worth mentioning this gotcha for folks using other regex parsers or
shells?

On Tue, Nov 12, 2013 at 12:13:31PM -0800, Greg Wilson wrote:
> On 2013-11-12 3:12 PM, W. Trevor King wrote:
> > On Tue, Nov 12, 2013 at 11:38:38AM -0800, Aron Ahmadia wrote:
> > > My inclination is just to teach folks the `^` version since it
> > > is recognized by Bash and less confusing for learners going on
> > > to regular expressions, which are hard enough already.
> >
> > If we get this deep into shell regex patterns, that's fine with
> > me. I think we should just introduce *, and move on to stuff we
> > care more strongly about like version control, testing, and
> > modular design. Unless the students are asking for regex
> > instruction explicitly, but I'm not sure how often that happens.
>
> I usually just do * and ? --- I'll amend the lesson accordingly.

This commit the examples turned up by:

$ git grep '\[\!' | grep -v '\(png\|pdf\|jpg\|odg\) matches'

See #137 and #145 for earlier discussion. This material predates the
`{tool}/{level}` restructuring, so I don't know if anyone's using it
anymore. If this material is a dead end, I'll drop this PR (and add a
new one removing the cruft ;). If this material is not a dead end, I
think this PR would be useful.

[1]:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_01
[2]:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05