How to echo a Bang/Exclamation Mark|Point (!) in Bash/Terminal/Command Line

How to echo a Bang/Exclamation Mark|Point (!) in Bash/Terminal/Command Line

echo "#!/bin/bash/"

-bash: !/bin/bash”: event not found

What’s going on?
Due to double quotes Bash is searching it’s history for /bin/bash/ and not finding any previous commands (events)

Fix: echo '#!/bin/bash/' using single quotes.

Leave a Reply

Your email address will not be published. Required fields are marked *