how to prevent bash or zsh from interpreting special characters code example

Example: how to prevent bash or zsh from interpreting special characters

# Short answer:
Escape the special characters with backslash e.g.:
echo This_is_a_wildcard_*
--> zsh: no matches found: This_is_a_wildcard_*
echo This_is_a_wildcard_\*
--> This_is_a_wildcard_*

# Using double quotes around the argument works as well, e.g.:
echo "This is a wildcard *"
--> This is a wildcard *

# Note, some of the special characters interpreted by bash/zsh include:
' " ! $ & [ ] ( ) ? *

Tags:

Misc Example