Interview Prep/Shell Scripting/Troubleshooting: syntax, parsing and interpreter errors

In your terminal, `echo "Deploy done!"` fails with `bash: !": event not found`.

IntermediateTroubleshootingTroubleshooting: syntax, parsing and interpreter errors
Answer

Likely causes → Interactive history expansion: ! inside double quotes refers to history. It does not happen in scripts (history expansion is off in non-interactive shells), which is why the same line works in a script.

Diagnose → echo $- shows H when history expansion is on.

Fix → Use single quotes (echo 'Deploy done!'), escape it (\!), put ! at the end outside quotes, or set +H in the interactive shell.

Prevent → Use single quotes for literal strings when testing interactively.

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Troubleshooting: syntax, parsing and interpreter errors