bash: !: event not found
There is a feature of bash
, called "history expansion" (see man bash
): it handles !
specially, even within double quotes.
Replacing double quotes with single quotes should help (history expansion doesn't happen there).
Also, history expansion doesn't happen in non-interactive shells (that is, your example will work as is in a script).