Bash, echo and an exclamation mark

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1483
Joined: Fri Aug 29, 2003 8:39 pm

Bash, echo and an exclamation mark

Post by ^rooker »

Learning something new every day!
Today I ran into the problem echoing a string in bash that contains an exclamation mark.
I'm pretty surprised, because I doubt that I never output a string like that before... Puzzling.

However.
Try the following in bash:

Code: Select all

echo "ouch!"
It returns:
-bash: !": event not found
WTF? :shock:

Read this:
http://qntm.org/bash
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply