This line works as expected on it's own
(echo '@$X!'; sleep 3; echo '@$X!')
And I need to insert this line in a file using the following command, but it's not working. The
echo'ed command must be executable.
echo "(echo '@$X!'; sleep 3; echo '@$X!') | mycmd" >> a
It keeps returning this error
sh: !': event not found
I understand that echoing a string between single quotes, inhibits any variable substituion or character escaping but I'm unable to apply that to solve this issue !
I have to do it through a command because I'll be sending it through a tool so editing the file using an editor is not an available option for me.