Why can I not use an exclamation mark in bash' echo, not even when it is escaped?

bash

Solution

You can use single quotes:

echo 'Hello!'
Hello!

Otherwise in double quotes shell attempts to expand `!` to an event from the history..

Problem

My question is simple: ``` $ echo "Hello!" sh: !": event not found ``` What is `!` in this case? I then tried `echo "Match\!"`, but that resolves to `Match\!`. How do I have to write the statement?

Original source