[Hampshire] Regular Expressions

Top Page

Reply to this message
Author: Chris. Aubrey-Smith
Date:  
To: hampshire
Subject: [Hampshire] Regular Expressions
I'm re-reading Kernighan & Pike, "The Unix Programming Environment",
in an attempt to resurrect my Regular Expression skills. However, I'm
finding that many of my old and trusted shell scripts won't work.

Of course, I'm aware of some differences between bourne and bash, but
I'm surprised to find so many odd and apparently needless discrepancies.

For example, the text gives the following as an illustration:

Quotes of one kind protect quotes of the other kind:

$ echo "Don't do that!"
Don't do that!
$

However, in bash on my Debian machine:

chris@T42:~$ echo "Don't do that!"
bash: !": event not found

Why is the ' in Don't protected by ", while ! is not? Or am I missing
something?

Chris.