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.
shmode (this is visible from the error message). I'm not getting that error from bash, though the$needs escaping (and I might have non-default options set). – Mat Aug 4 '12 at 13:06!? And what happens withaafterwards, does it get executed as a shell script? – patrix Aug 4 '12 at 13:23$must be appended by a character. The file being appended will be executed on each startup and it's very important to have it this way. – Muhammad Gelbana Aug 4 '12 at 13:25